Page 1 of 1

potential bug setting density and units in PNG IM 6.5.4.0

Posted: 2009-06-29T11:25:43-07:00
by fmw42
IM 6.5.4.0 Q16 Mac OSX Tiger

Create test image:
convert rose: rose.png
identify -verbose rose.png
Image: rose.png
Format: PNG (Portable Network Graphics)
Class: DirectClass
Geometry: 70x46+0+0
Resolution: 72x72
Print size: 0.972222x0.638889
Units: Undefined


Now change the density and units:
convert rose.png -density 300x300 -units pixelsperinch rose2.png
identify -verbose rose2.png
Image: rose2.png
Format: PNG (Portable Network Graphics)
Class: DirectClass
Geometry: 70x46+0+0
Resolution: 118.11x118.11
Print size: 0.592668x0.389467
Units: PixelsPerCentimeter

Re: potential bug setting density and units in PNG IM 6.5.4.0

Posted: 2009-06-29T11:59:37-07:00
by magick
Apparently the PNG specification only permits pixels per centimeter and does not support pixels per inch.

Re: potential bug setting density and units in PNG IM 6.5.4.0

Posted: 2009-06-29T12:34:09-07:00
by fmw42
magick wrote:Apparently the PNG specification only permits pixels per centimeter and does not support pixels per inch.
OK. 300 dpi / 2.54 cm/in = 118.11 dpc

P.S. Perhaps Anthony would not mind adding a comment to his page about PNG format to point this out. Thanks

Re: potential bug setting density and units in PNG IM 6.5.4.0

Posted: 2009-06-29T22:18:35-07:00
by anthony
Perhaps 'undefined' means Pixels Per Inch.

I think we should get the PNG experts view on this!


Question. If the units is currently DPC, and you change it to DPI, is the density values corrected
appropriately?

I suppose then you should use -set to ensure one setting does not change the other!

Re: potential bug setting density and units in PNG IM 6.5.4.0

Posted: 2009-08-11T07:33:05-07:00
by Mazin
According to the PNG specification ( http://www.w3.org/TR/PNG/#11pHYs ), the pHYs field contains pixel dimensions on the X and Y axis along with a unit specifier. This unit specifier has two options: none, and metres. So if I understand this correctly, you can either set pixel/metre or the aspect ratio only. That is, a setting of 72 by 72 without units only says that the image has square pixels, and I would guess that the application is free to interpret this as a default 72 or whatever it wants to. No other units besides "none" and "metre" are defined.

Forgive me if I misinterpret the spec.