How to find the dimensions of multiple images on a Mac

29 April 2009 · 1 comment

Get Info shows you size details for one image, but what about a whole lot of images? Try this Terminal tip.

 

In the General section of that window you see the ‘size’ of the image in Kilobytes (or maybe Megabytes), eg 176 Kb. In the More Info section of the Get Info window you see the image Dimensions in pixels, eg 1000 * 750.

The Get Info window shows file size and image dimensions

The Get Info window shows file size and image dimensions

Control click on an image, such as a photo, in the Finder. The Get Info window appears.

Now select several images and you have a problem. To discover the dimensions you must look at a Get Info window for each image. That works for one or two, but not for dozens or hundreds.

And what if you want to note down those dimensions? You could be in for a huge amount of very tedious work, unless you buy software to handle the task for you.

Or you could quickly and easily get your Mac to do that work for free using the scriptable image processing system, otherwise known as sips.

Use the Terminal to get image dimensions

  1. Open the Terminal (it’s in Applications > Utilities). A Terminal window appears.
  2. Type: cd (that’s cd followed by a space), then
  3. drag in the folder containing the images whose dimensions you want to know. The file path is added at the end of the line.
  4. Press Return. The Terminal now knows to look in the right place for the images you’re getting information about.
  5. Type in the following (watch the spaces):
    sips -g pixelHeight -g pixelWidth *
  6. Press Return. A list of image dimensions is output to the Terminal window.

[Based on information in: macosxhints.com - Get the dimensions of most images from the command line.]

Type in the Terminal command

Type in the Terminal command

·
Output the information to a file

Output the information to a file

Save the list to a file

To save the information out to a file redirect the output. Replace Step 5 with the following:
sips -g pixelHeight -g pixelWidth * > dimensions.txt

Now the dimensions will be saved to a file called dimensions.txt, saved in the same folder as the images are in.

Listings look like this example:

/Users/miraz/Dropbox/Photos/paddy-the-wanderer/paddy-wanderer-0257.jpg
  pixelHeight: 800
  pixelWidth: 600

The text file lists details for all selected images

The text file lists details for all selected images

If you’re a web developer you could now open that file in a text editor and use some scripts to create any HTML coding you require.

When I tried this on a folder of around 1,200 photos on a network drive it was less than a minute before that text file was created. It listed file path, file name, width and height for all 1,200 photos.

Other articles that might interest you

  1. Do your images drive people away?
  2. The skinny on images in web pages and email
  3. Resize images with Automator
  4. A Historic Terminal
  5. List Applications and More

Did you try this out? How did it work for you? Let us know in the comments.

Clip to Evernote

1 comment

Tell us what you think.
Note: there may be a delay before your comment appears. I now approve all comments from new visitors, in an attempt to keep spam at bay.

{ 1 comment… read it below or add one }

Nelly 26 January 2011 at 05:11 20

OMG! Wonderful tip. I was trying applescript to achieve the same & boom this better, easier & faster. THANK YOU :-)

Reply

Add your Comment

Older Post:

Newer Post: