[Thread Prev][Thread Next][Index]

[ferret_users] PyFerret: DPI info for PNG output



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 dots per inch (DPI) and it is 1000 dots x 500 dots, its physical size is 10 in x 5 in.

The number of dots can be specified by the XPIXELS qualifier to the FRAME command, but the physical size of the image should remain the same regardless of the number of dots and should match that of the PDF file.  That means, the DPI value would have to be calculated accordingly to the value of XPIXELS.  (The DPI can be different between the x and y directions, so the y-DPI should also be calculated in accordance with YPIXELS.)

A use case:  I mix PDF images with PNG images in a single document and I want to shrink all of them at a constant ratio, say 50% of the original physical sizes.  For PDF files, you just specify "50%".  For PNG files, you need to know the DPI to know its original size before the ratio "50%" makes any sense.  Without the DPI info associated with the image file, the software (in my case LaTeX) has to assume a DPI value to be able to determine its size within the page.  Because the value the software assumes is wrong, I don't know how much I should shrink it.

Even if you have adjusted the size by trial and error, you have to change the scaling again when you change the value of XPIXELS for the same figure!

Regards,
Ryo




[Thread Prev][Thread Next][Index]
Contact Us
Dept of Commerce / NOAA / OAR / PMEL / Ferret

Privacy Policy | Disclaimer | Accessibility Statement