Aperture, Journal, Photography, Technology

Aperture Scripting

Aperture

Aperture arrived today. Good thing my replacement 4GB RAM modules also arrived today from OWC.

The first thing that Rae and I did after installing the software was to watch the Aperture DVD Tutorial. This was a great introduction to the features and functionality of the program. Some of the material was lifted from the web tutorials on the Aperture web page, including the guy with the British accent! Alas, he did not pop up ala Microsoft Bob to highlight the features of Aperture during the DVD.

I am writing an AppleScript that transfers annotations from my iView catalogs into Aperture image versions. My file structure for my annotated RAW images has been well-documented, and it will make writing this script relatively straightforward — if anything in AppleScript can be straightforward! A tricky part was mapping iView’s annotation field names to Aperture’s. Fortunately, I found the IPTC Rosetta Stone. Since Aperture’s IPTC field names are identical to IPTC, it was a snap to map iView’s field names over. There were some strange mappings, like Event and People in iView to FixtureIdentifier and Contact in Aperture/IPTC!

iView 2.6.4 Aperture
caption Caption
annotation writer Writer/Editor
event date DateCreated
categories SupplementalCategory
keywords Keywords
title Headline
instructions SpecialInstructions
author Byline
author title BylineTitle
credit Credit
source Source
product ObjectName
city City
state Province/State
country Country/PrimaryLocationName
transmission OriginalTransmissionReference
genre Category
copyright CopyrightNotice
status EditStatus
event FixtureIdentifier
location Sublocation
people Contact

To your right is a list of field mappings from iView to IPTC/Aperture:

Now, I would love to finish this script, but I’ve run into a significant roadblock. AppleScript throws an error when you try to edit an IPTC tag that does not yet exist in an image version in Aperture. I have the following check in my script:

if not (exists IPTC tag “Contact” of theImage) then

make new IPTC tag “Contact” at end of IPTC tags of theImage with properties {value: “Adam Tow”}

make new IPTC tag “Contact” at IPTC tags of theImage with properties {value: “Adam Tow”}

make new IPTC tag at end of IPTC tags of theImage with properties {name: “Contact”, value: “Adam Tow”}

end if

None of the three lines work, with lovely and familiar AppleScript errors like:

  • Aperture got an error: Can’t make IPTC tag “Contact” into type type class.
  • Aperture got an error: NSInternalScriptError
  • Aperture got an error: NSContainerSpecifierError

I really hate playing AppleScript syntax gymnastics! How in the world do you add a new IPTC tag class object to the IPTC Tags property of an image version?!? There’s an Automator action called Set IPTC Tags which does exactly what I want it to do, but the clever folks at Apple made the script read-only. I can’t see how they deal with the case when the IPTC Tag is not already in the image file!

Are there any crack AppleScript gurus who can help me debug this situation?

It’s 4:21 am right now. When everyone in the US is asleep, people in Europe and Asia are awake to help me! Thanks to Paul Guyot, I’ve been able to track down the correct syntax to use. Looking at the dictionaries, script suites, and script terminologies for Aperture, we discovered that you need to tell the image itself to make a new IPTC tag entry!

tell theImage
make new IPTC tag with properties {name:”Contact”, value:”Adam Tow”}
end tell

AppleScript and Cocoa make it so hard and yet so easy sometimes!

iView2Aperture

Now the next problem is determining what is the currently selected album, image, project etc. There is a selection object available, but I can’t yet determine the properties. There does not appear to be any current or selected keyword in Aperture.

Workaround time. I created a root-level folder called iView2Aperture, in which I could place Projects, Folders, and Albums. My script, now and AppleScript Studio Application, performs the following task:

  1. Iterate through every photo contained in the folder
  2. Opens the appropriate iView catalog
  3. Copies all annotations from the iView media item into the Aperture image version

The program does a complete replace of the data from iView to Aperture. There’s no synchronization going on.

iView2Aperture

My script relies heavily on the way I have organized my iView catalogs. As I wrote in my article on my photo workflow, I separate my iView MediaPro catalogs by Year-Month. The filename is the master key which stays the same between Aperture and iView. Based on the shooting date and time, the filename is parsed by AppleScript to determine the appropriate iView catalog to open. Once that’s done, it’s easy to copy the annotations from iView over to Aperture — as easy as AppleScript makes it, of course!

iView2Aperture

Click on the image above to see how all the annotations have been copied from iView to Aperture!

This is one of the ugliest apps I’ve ever written, but hey, what can you expect at 6:00 in the morning :) I’ll eventually get around to cleaning up the interface and releasing this to the world. One stumbling block for potential users is the way that I’ve hardcoded the way I organize my files into the application. The hardest part to generalize the program would be in finding the right iView catalog for each image in Aperture.

Treating RAW as RAW?

In general, I don’t sync my annotations to the original files using iView. I read that iView 3 handles annotations better than in previous versions of the application. All that said, it doesn’t seem to matter if the annotations have been written into the RAW file or not, because Aperture doesn’t read them!

Photoshop CS is able to read the IPTC annotations that I have added to the RAW file under File Info. Frankly, I’m surprised that Aperture doesn’t do the same. I guess they really just want to read the RAW data from the image and nothing else!

The way the program is set up, it really forces you to use their system to the exclusion of everyone else’s. For a variety of reasons that I will cover in a future article, I’m not ready to import all of my photos into Aperture. It’s my hope that more programs like iView2Aperture will be available to welcome Aperture into the digital toolbox of photographers.

Standard

2 thoughts on “Aperture Scripting

  1. Trevor Craig says:

    Adam,
    Your Applescript is exactly what i am looking for. I also have my files organised in the same way as you do (by year and month) and am frustrated with Apertures inability to read 4500 raw Nikon files from by D100 and D2x which have been carefully anotated over the years in iView Multimedia pro. The really annoying thing is that this information exists in the Raw file because even after exporting it as a Master from within Aperture you can still read it in Photoshop CS2’s File Info page! Just as daft is the fact that all embedded IPTC field information like Keywords, State and City are readable by Aperture in imported JPEGS but ignored in raws.

    Please let me know when you are releasing this script as I am very keen to use it (or even beta test it for you) Right Now Aperture is just a very expensive file browser for me.

    Regards
    Trevor Craig

  2. Andy Fragen says:

    Adam,

    What doing the following.

    From iViewMedia Pro, Select all the images in your Catalog. Go to the Action > Sync Annotations… menu and select the button for ‘Export annotations to original files.’

    Then just import normally into Aperture.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s