How to change PNG dpi when saving chart

When I save a chart as a PNG, I first adjust the width and height so that it renders in much higher resolution than what is seen on the screen, such as 2400x1800 (8 inches by 6 inches at 300dpi printer resolution), then after the save set it back to the screen resolution. This works just fine with regard to the image in the PNG file. When I open the resulting PNG file it is the proper resolution, but its physical size is way too big.

Chart1->MakeScreenshot()->SaveToFile(L"chart.png");

Note that the function:

Chart1->SaveToImage (L"chart.png");

does not work. It creates a blank rectangle. The MakeScreenshot works fine just has the wrong DPI, which calls the Firemonkey codec for creating a PNG image.

PNG files have a reference DPI parameter that an application uses to calculate the actual physical size of the image when rendering. Although its value has no effect on the image itself, it does affect how large the image is when rendered. 2400 dpi becomes 8 inches wide when rendered with a DPI setting of 300, versus 25 inches at 96 dpi.

Using the FNC Core PDFLib.. I tried inserting the image as a test. It rendered much too big rendering at 96 dpi. The FNC Chart inserts a DPI of 96, which is screen resolution. All I want to do is have the operation make the DPI value 300 when the PNG is created., 2400 pixels becomes 8 inches at 300 dpi. I used Photoshop to adjust the DPI setting in the PNG file. The PDFLib inserted the correct size image after this adjustment to the DPI paramater

So I am looking for one of two possible solutions.

  1. The ideal solution is to tell the PNG codec to embed a value of 300 DPI into the PNG file when it is created instead of the 96 dpi screen resolution. Looking through all the documentation, I cannot figure out how to do that. Does FNC Chart have a parameter I can set to adjust the rendering DPI?

  2. The other option is how to tell the FNC PDFLib module to render that PNG file to a width of 8 inches (2400 pixels at 300dpi) instead of it rendering to an oversized clipped 25 inch wide image (2400 pixels at 96 dpi). I could not find a way to tell the PDFLib module what dpi to use or what size to make the rendered image. Is there a parameter I can set to adjust the actual size when inserting the PNG into a pdf page?


Scott

There is currently not a setting for this.
It is an interesting suggestion and we will investigate & consider extending the MakeScreenshot function to allow DPI selection. At this moment, this is limited to screen resolution as there it is where it is rendered.