PNG Codec DPI

This is the forum for miscellaneous technical/programming questions.

Moderator: 2ffat

Post Reply
smd
BCBJ Guru
BCBJ Guru
Posts: 140
Joined: Sat Nov 29, 2014 8:02 pm
Location: Las Vegas
Contact:

PNG Codec DPI

Post by smd »

I have a program that creates a graphical chart of some data. When the user clicks the save button, the image is saved as a PNG file. That works ok. The problem is that the PNG file has the DPI set at screen resolution (like about 96dpi), but the output is intended for 300 dpi.

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

Invokes the Firemonkey internal codec for creating the ping file. It works. All I want it to do is not use the screen resolution dpi, but change it to 300 dpi. The PNG dpi parameter is just a reference used by programs that read the image to figure out the physical dimensions of the image. I can change it by loading it into Photoshop, changing the value, then re-saving it. Setting the proper dpi parameter lets other programs, such as Word or OpenOffice scale the image to its proper size when it loads.

So the question is how to tell the Firemonkey codec that generates the PNG file to use a different DPI setting?
-----------------------------
Scott
rlebeau
BCBJ Author
BCBJ Author
Posts: 1759
Joined: Wed Jun 01, 2005 3:21 am
Location: California, USA
Contact:

Re: PNG Codec DPI

Post by rlebeau »

smd wrote: Sat Dec 19, 2020 2:46 pm So the question is how to tell the Firemonkey codec that generates the PNG file to use a different DPI setting?
I have not dug into the FMX source code to verify this, but AFAIK there is no way to specify a DPI manually.
Remy Lebeau (TeamB)
Lebeau Software
Post Reply