Getting an image file's dimensions quickly

Mikuro

Crotchety UI Nitpicker
I'm writing a program that needs to get the width and height of large groups of images. I want to get the dimensions without actually loading the image (since that takes too long). The Finder has been able to quickly do this with a wide variety of image formats for years, but I can't figure out how to do it myself.

Any ideas?

I would love to be able to do this in AppleScript or REALbasic, but I'm open to other options like Cocoa.
 
Thanks guys.

iMagine Photo (the application that Automator action that Eric posted uses) is a nice find. It lets AppleScript/Automator users do a bunch of things with images, and a quick test shows pretty good performance getting image dimensions. It's about 4x faster than my code in REALbasic, and about 8x faster than a similar AppleScript based on System Events. Relying on a third-party app is not ideal, but if I can't come up with anything better, I could go with it.


With a little more googling, I found something called ExifTool that looks promising as well. I haven't had time to really look into it, but it says it supports a ton of image files and it sounds like it can return the metadata without loading the image data (i.e., quickly).
 
Back
Top