BMP转JPG
uses Vcl.Imaging.jpeg//涂磊添加 20241113 procedure TSimpleGraph.SaveAsJPEG(const Filename: String); //涂磊 BMP 转 JPG 添加20241113 var Bitmap: TBitmap; JPEGImage: TJPEGImage; begin JPEGImage := TJPEGImage.Create; Bitmap := GetAsBitmap(Objects); try JPEGImage.Assign(Bitmap); JPEGImage.SaveToFile(Filename); finally Bitmap.Free; JPEGImage.Free; end; end;
uses Vcl.Imaging.pngimage; procedure TSimpleGraph.SaveAsPNG(const Filename: String); //涂磊 BMP 转 PNG 添加20241114 var Bitmap: TBitmap; PNG: TPNGImage; begin PNG := TPNGImage.Create; Bitmap := GetAsBitmap(Objects); try PNG.Assign(Bitmap); PNG.SaveToFile(Filename); finally Bitmap.Free; PNG.Free; end; end;