dpi or dots per centimeter

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
robuntu
Posts: 41
Joined: 2012-01-22T10:56:10-07:00
Authentication code: 8675308

dpi or dots per centimeter

Post 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
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: dpi or dots per centimeter

Post 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:
Post Reply