[Thread Prev][Thread Next][Index]

Re: [ferret_users] PyFerret: DPI info for PNG output



Hi Ryo,

I was not aware that PNG images have an optional dots-per-meter specification.  Thus, there currently is no attempt to assign such a value when creating raster image files (such as PNG and JPEG.)  I do now see in Qt there are the QImage.setDotsPerMeterX and QImage.setDotsPerMeterY methods which presumably set these values (and hopefully not anything more than that).  So I can try adding that in.

When PyFerret does need DPI values, for displayed windows it does get the values for the window using the physicalDpiX and physicalDpiY methods of the QMainWindow.  For windows that are not displayed (so using the "-nodisplay" command-line option for PyFerret), the default value of 96 DPI is assigned since there is no display to obtain a value from, and that value was pretty standard at the time.

Best,
Karl


On Tue, Jan 21, 2020 at 1:50 AM Ryo Furue <furue@xxxxxxxxxx> wrote:
Dear Ferret developers,

If I'm not mistaken,  the PNG output from PyFerret (via FRAME/file=image.png ) does not store the correct DPI information in the header of the generated PNG file.  It would be nice if PyFerret actually calculates and stores that information.  (It seems that the DPI value is set always at 72.)

Explanation:  The PDF output includes the physical size of the image.  (Open the image on Acrobat Reader and see "File" > "Properties".)  The PNG format can achieve the same effect by including the DPI information in its header.  For example, if the header says that the image is to be displayed at 100 do


--
Karl M. Smith, Ph.D.
JISAO Univ. Wash. and PMEL NOAA
"The contents of this message are mine personally and do
not necessarily reflect any position of the Government
or the National Oceanic and Atmospheric Administration."

[Thread Prev][Thread Next][Index]