Page 1 of 1

Is there a way to list image dimensions for .png files?

Posted: 2016-03-31T16:53:14-07:00
by rickgut2016
Is there a way to list image dimensions for .png files? I'm using this code, and I'm only getting the file dimensions of .jpg, and .gif files.

identify.exe -format "%f %w %y" *.*

I'm getting this error for .png files:
identify.exe: improper image header `ccp-pd-080-90.png' @ error/png.c/ReadPNGImage/3921.

Any help would be greatly appreciated! Thanks ya'll!

Re: Is there a way to list image dimensions for .png files?

Posted: 2016-03-31T17:57:38-07:00
by fmw42
What is your IM version and version of libpng?

You can get them from

Code: Select all

convert -version

Code: Select all

convert -list format
See http://www.imagemagick.org/script/escape.php

"%y" is not the height, but the resolution (dpi) in the vertical dimension. If you want the height, use "%h"

Re: Is there a way to list image dimensions for .png files?

Posted: 2016-04-01T04:32:40-07:00
by snibgo
rickgut2016 wrote:improper image header `ccp-pd-080-90.png'
It sounds like a problem with that file. Please upload to somewhere like dropbox.com and paste the URL here.

Re: Is there a way to list image dimensions for .png files?

Posted: 2016-04-01T10:33:57-07:00
by rickgut2016
Here is my version info:

Version: ImageMagick 6.9.3-7 Q16 x64 2016-03-06 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2015 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Visual C++: 180040629
Features: Cipher DPC Modules OpenMP
Delegates (built-in): bzlib cairo freetype jng jp2 jpeg lcms lqr openexr pangocairo png ps rsvg tiff webp xml zlib

and

PNG* PNG rw- Portable Network Graphics (libpng 1.6.20)

I will use %h, thank you! Please let me know if I need a different version of anything. Thanks so much! This is a work project, so it would be sweet if I can get it working. Basically I need to list the dimensions (width, height) of 28 thousand files.. Looks like the files are .jpg, .gif, and .png.

Re: Is there a way to list image dimensions for .png files?

Posted: 2016-04-01T10:58:14-07:00
by fmw42
See snibgo's comment above about providing your png input file.

Re: Is there a way to list image dimensions for .png files?

Posted: 2016-04-01T11:45:48-07:00
by rickgut2016
Update: It looks like those .png files are corrupt. I should have checked that fist.. Thanks for the help all. I learned a few things :D