fogbound.net




Sat, 17 Nov 2007

Aperture Import Script

— SjG @ 7:14 pm

So, after the demise/µsoftification of iView Media Pro, the time came to switch to Aperture.

However, while Aperture is mighty powerful, its limitation of 10,000 images in a project makes import of my photos difficult. What’s more, my … er … unique system of “organization” doesn’t natively work well with Aperture. My attempt at organization, which predates such things as iView, Aperture, or even a usable Bridge, is predicated on the idea of the filesystem as a hierarchical database of sorts.

For example, I start with a directory called “photos” and within it are directories for “animals,” “events,” “people,” “places,” “things,” “projects,” etc. Within “events” are “political,” “work,” “family,” etc. With each of these are either further taxonomic directories, or what might be equivalent to rolls-of-film directories, e.g., “MothersDay-2007-05-13” or “CocktailsAtBerris-2000-06-14.” Directories are all Unix-friendly (no spaces or crazy punctuation) and are generally CamelCase for multiple words.

So I went through a frustrating attempt to write a good Applescript importer. The problem with languages like Applescript (or Javascript implementations embedded in Adobe products) is that they promise more than they can deliver. They’re designed to interact with Applications, but generally don’t have rich access to application functionality. Why can’t I create a folder in my Aperture library in Applescript? Why can’t I get/set a single pixel in Photoshop with Javascript. Yes, I know both are possible through some crazy GUI-script calls or cryptic Event IDs, but why give me the equivalent of object-oriented access and then leave out all the important methods?

Well, enough ranting. With a lot of help from others who have gone before me and posted comments and, even better, code, I hacked together something that will read in my hierarchy, create a new Aperture Project for each leaf node on my tree, and convert the path to that node into a set of keywords which it will apply.

So “photos/events/family/MothersDay-2007-05-13” will become a project named “MothersDay-2007-05-13” and the images within it will all be tagged with the keywords: Events, Family, Mothers, Day, 2007-05-13. It’l also throw in copyright notices and author name.

There’re provisions for excluding words from becoming tags (e.g., “and”) as well as special case code for directories named “misc,” which I often use as catchalls for a taxonomical branch — these get named for the parent directory plus the “misc” (e.g. “ArthopodsMisc”).

Perfect? No. Better than doing it manually? Yes.

In any case, here it is:
Aperture Importer


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.