Page 1 of 1

identify resolution (or how many pixel image has)

Posted: 2010-11-12T16:26:41-07:00
by myspacee
Hello from awindows user,
try to isolate image resolution value and put this information in a txt file.

I need this information to do some things, try this :

Code: Select all

identify -verbose 1.gif | find "Resolution:"
but i need only resolution value (eg: 72x72)

is there any way to obtain this in simple way, or directly how many pixel are in given image ?

thank you all for help,

m.

Re: identify resolution (or how many pixel image has)

Posted: 2010-11-12T16:51:43-07:00
by GreenKoopa
Check out the -format option. Also:
http://www.imagemagick.org/script/escape.php

Code: Select all

identify -format "%x x %y" 1.gif
convert 1.gif -format "%x x %y" info:

Re: identify resolution (or how many pixel image has)

Posted: 2010-11-13T03:14:35-07:00
by myspacee
thank you for reply,
run commands and both return "72 Undefined x 72 Undefined" , why ?

any pixelcount script around ?

thank you again,

m.

Re: identify resolution (or how many pixel image has)

Posted: 2010-11-13T11:12:22-07:00
by fmw42
myspacee wrote:thank you for reply,
run commands and both return "72 Undefined x 72 Undefined" , why ?

any pixelcount script around ?

thank you again,

m.
Either your image resolution is actually 72 and no units supplied (Undefined) or nothing is defined and IM is assuming 72.

You can see all the details that IM knows about by

identify -verbose image


To get counts of pixels, I assume you mean width x height.

convert image -format %[fx:w*h]" info:

please see all the string formats that you can get per the reply above and fx calculations that you can make such as this one at:

http://www.imagemagick.org/script/escape.php
http://www.imagemagick.org/script/fx.php