Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a folder with hundreds of images. I would like to obtain a list of their dimensions (width, height) without having to manually check each image. Something similar to this:

image001.jpg, 1024, 768

How can do I this (Mac/*nix solution preferred)?

share|improve this question

2 Answers 2

up vote 2 down vote accepted

With ImageMagick:

identify -format "%f, %w, %h\n" *.jpg

or

find . -iname '*.jpg' -exec identify -format "%d/%f, %w, %h" {} \;
share|improve this answer
    
+1, more tidy than my answer :) figured imagemagick could do it –  Sirex Sep 1 '10 at 8:36

use file.

"file *.jpg"

to process it you could always do something like

for i in `ls *.jpg`
do
output=`file $i`
res=`echo $output | cut -d "," -f2`
name=`echo $output | cut -d ":" -f1`
echo $name $res
done

or use awk or something similar to process the output of file, but either way it should do the job.

share|improve this answer
2  
Don't use `ls` in for. Just use the glob pattern directly. –  Ignacio Vazquez-Abrams Sep 1 '10 at 8:02
    
On my system, file doesn't output the size for JPEG files. –  Dennis Williamson Sep 1 '10 at 8:36
    
hmm, worth knowing. –  Sirex Sep 1 '10 at 8:37

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.