Question
“Is is possible to export jpegs that are gray scaled?”
Solution
Use the Report.OnFileDeviceCreated event to configure the JPGDevice.Jpeg property. This Jpeg property is of type TJpeg, a Delphi VCL class.
All of the image devices share this common architecture. The BmpDevice has a Bitmap property, the MetaFileDevice has a Metafile property, etc.
Download: JpgDeviceGrayScale.zip
Sample Delphi Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
uses ppDevice, ppFileUtils, ppImageDevice; procedure TForm1.ppReport1FileDeviceCreate(Sender: TObject); begin // configure JPEG to gray scale if (ppReport1.FileDevice is TppJPGDevice) then TppJPGDevice(ppReport1.FileDevice).JPEG.Grayscale := True; end; procedure TForm1.Button1Click(Sender: TObject); begin ppReport1.TextFileName := TppFileUtils.GetApplicationFilePath + 'myReport.jpg'; ppReport1.Print; end; |