Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
up vote 2 down vote accepted

With ImageMagick:

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


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`
output=`file $i`
res=`echo $output | cut -d "," -f2`
name=`echo $output | cut -d ":" -f1`
echo $name $res

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

share|improve this answer
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


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.