Page 1 of 1

dpi or dots per centimeter

Posted: 2012-05-26T05:40:20-07:00
by robuntu
Hi
If I use a "identify -verbose img.png" I get:
...
Geometry: 3553x748+0+0
Resolution: 190x190
Print size: 18.7x3.93684
Units: PixelsPerInch
...

but if I use
identify -format "%x" img.png
I get:
74.8 PixelsPerCentimeter

What do I have to place after "-format" do get the "190" instead of the "74.8" ?

Greeting
Roland

Re: dpi or dots per centimeter

Posted: 2012-05-26T10:00:23-07:00
by fmw42
As far as I know PNG only supports pixelspercentimeter. see http://www.imagemagick.org/Usage/formats/#png_density

So I am surprised you get units of pixels per inch in the verbose info. I suspect IM convert the pixels per inch to the equivalent pixels per cm when showing %x. 74.8*2.54=190.

I suspect that your png image is not correctly created if it shows pixels per inch in the verbose info.

However, this will convert to pixelsperinch for showing units and density.

convert image.png -units pixelsperinch -format "%x" info: