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
potential bug setting density and units in PNG IM 6.5.4.0
Re: potential bug setting density and units in PNG IM 6.5.4.0
Apparently the PNG specification only permits pixels per centimeter and does not support pixels per inch.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: potential bug setting density and units in PNG IM 6.5.4.0
OK. 300 dpi / 2.54 cm/in = 118.11 dpcmagick wrote:Apparently the PNG specification only permits pixels per centimeter and does not support pixels per inch.
P.S. Perhaps Anthony would not mind adding a comment to his page about PNG format to point this out. Thanks
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: potential bug setting density and units in PNG IM 6.5.4.0
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!
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!
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
Re: potential bug setting density and units in PNG IM 6.5.4.0
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.
Forgive me if I misinterpret the spec.