Image Events too slow accessing EXIF data

Does anyone know of a faster way of accessing EXIF data via AppleScript than using Image Events? I’m using something along the lines of the following, and it’s painfully slow:

set ImageFile to choose file
tell application “Image Events”
set ImageFile to open file ImageFile
set CreationDateTime to value of metadata tag “creation” of ImageFile
end tell

All suggestions gratefully welcomed. Scripting Additions? Shell scripts I can run via AppleScript?

When you say slow, how slow?

Also are you just processing 1 file, because if you are and because “Image Events” is an application that has to start up then for the first file this will be really slow. But if you keep firing it with requests while looping through each meta data type and you are processing lots of files then the cost of start up will be amortized.

Kevin

I’m actually processing several hundred files at a time, and each is a JPEG weighing in at roughly 4-5mb. Is there a way of getting Image Events (or something else) to pull the EXIF data out of an image without having to load the entire file from disk?

But how slow,

10 files a second, 5 files a second, 1 file a second, 5 seconds to a file etc.?

Kevin

Sorry - about 10 seconds/file on a dual 1Ghz G4.

That does seem excessively slow.

Possible things that could be slowing you down are:

Your image files does not have the correct file extension “.jpg” or or file type. The reason this make a difference is because Quicktime (which image events probably uses) has to make a decision about which importer (JPEG, TIFF etc.) knows how to interpret the file. The first importer it tries is based on the file extension or file type, and if this is correct it doesn’t try any other importers. If not then it will give the file to all its importers and ask them if they can interpret the file. This can take some time.

Secondly you might be asking for lots of different meta data types one at a time. Try:


set theValues to every metadata tags of ImageFile

and then interpreting the data returned in theValues.

Thirdly, Image Events has a quit delay property, it might be quiting more regularly than you want and it keeps having to be restarted. To stop it doing this try setting the quit delay to a larger value, but remember this will mean that Image Events wont quit soon after you have finished processing.

There are other options, Kanzu has a “Image Info” application that can be scripted to get image data and has a wider range of exif types that it recognizes compared to “Image Events”. check it out at http://www.kanzu.com.

Or my soon to be released update of iMagine which will include a larger range of exif data types that it knows about compared to the previous version, and it can also write exif data as well. I know for sure that iMagine’s perfomance is much better than what you are getting, for me it currently does 5 files per second (File size of either 120kb, or 1.3MBytes). If you are interested in a beta then please click on the e-mail button below.

Kevin

Many thanks for all of the tips - it’s greatly appreciated.

The tips on speeding up Image Events didn’t have much effect, but I downloaded Image Info 3.1 and it rips straight through my 4.95GB of JPEGs and TIFFs I’ve been testing this script on. A very impressive little application, and well worth the registration fee, so thanks for the tip.