Saving a tchart's image to a Jpeg file lazarus / 39-Graphics ---------------------------------------------------------------------- Pi · 2014-07-08 18:17 Is there a simple way to save a Tchart's image to a Jpeg file? ---------------------------------------------------------------------- wp · 2014-07-08 18:26 Code: [Select]  Chart1.SaveToFile(TJPEGImage, 'MyImage.jpg'); See also the demo project in components/tachart/demo/save of your lazarus installation, or http://wiki.lazarus.freepascal.org/TAChart_Demos#save ---------------------------------------------------------------------- Pi · 2014-07-08 18:41 Quote from: wp on July 08, 2014, 08:26:57 pmCode: [Select]  Chart1.SaveToFile(TJPEGImage, 'MyImage.jpg'); See also the demo project in components/tachart/demo/save of your lazarus installation, or http://wiki.lazarus.freepascal.org/TAChart_Demos#save Thanks. I looked in the demo program you said and found the code similar to above (I didn't see the bit of code in the post before) . That's what I wanted thanks. Is there a way of changing the compression ratio / compression quality/file size of the jpeg of the saved chart (eg. I don't mind if the file size of the jpeg gets bigger)? If not it's okay. ---------------------------------------------------------------------- wp · 2014-07-08 18:51 Not quite sure, but could you try this one: Code: [Select]procedure TForm1.Button1Click(Sender: TObject); var   jpg: TRasterImage; begin   jpg := Chart1.SaveToImage(TJpegImage);   try     TJPegImage(jpg).CompressionQuality:=10;  //10% quality - pretty low-quality!     jpg.SaveToFile('d:\temp\test.jpg');   finally     jpg.Free;   end; end; The image looks pretty ugly, could be 10% quality - I guess it works. ---------------------------------------------------------------------- Pi · 2014-07-08 19:05 Yes, thanks a lot, that works