Aperture MetaData

Introduction

Aperture stores quite a lot of Exif metadata of your image. However, it doesn't let you view some very interesting data as stored in Maker Notes. Examples are: Lens ID, Auto Focus points used, Metering mode and more.

Allan Hise made scripts to get hold of this information and store it in your Aperture library. That script uses the ideas of another script, made by Brett Gross, to locate the actual file associated with an image. The script uses the version name and executes a unix find to locate the .apfile file corresponding to the selected image. And then investigates the found .apfile to determine the path of an image if it is referenced or deduce the path to the image file from the path to the apfile.

I encountered some trouble in using this script. I have several versions of images and I also keep the camera generated jpeg's in the Aperture library. Fiddling was required to get it working the way I wanted especially in the case of versions created from the master JPEG images. I also ran into problems with duplicate filenames. If there are two distinct images in your library with identical basenames such as DSC_034 the method of locating the file associated with an image by using Unix find simply won't work correctly. The issues were known and mentioned.

Aperture must store the file information about an image somewhere in the library, otherwise it wouldn't be able to display an image on the screen. What I wanted to do is this: given a selected image, query the Aperture library to retrieve the fileinformation for that image (the path to the image file). Then you won't have to fiddle with the version name and you don't have to modify the scripts for RAW specific file extensions.

Brett Gross also provides information on the structure of an Aperture library and provides an AppleScript to extract information on the filestatus (managed or referenced) and the filepath of an image. You can use the sqlite3 program to extract information from the Aperture library using SQL queries. I modified the original Allan Hise script to use this method for finding the image file associated with a selected image.

Scripts

I have combined the techniques used in the original script to roll my own scripts to either display or store additional Exif information about images using sqlite3 to access information stored in the Aperture library and exiftool to extract data from the original camera generated file. The main advantage of this method is that the file associated with each selected image is located unambiguously regardless of your image naming conventions and Aperture's naming conventions of versions; it also appears to be quite quick.

This direct querying of the Aperture database wouldn't be necessary if Aperture could provide the full path of a selected image. I've provided feedback on this matter to Apple.

There are four scripts (AppleScript).

ApertureDisplayCustomMetaData

This displays metadata in an Applescript dialog for each currently selected image. You should see something like this. I know it's ugly but I can't help that; it's AppleScript.

If you click Cancel the script will stop. If you click OK the script will move on to the next image.

ApertureExtractCustomMetaData

This script instructs Aperture to create new additional metadata fields for each currently selected image. After applying the script on the same image as the previous script, you'll see something like this in the Aperture Metadata view when tab Other is active.

The script will silently (sorry, no progress indicator) process all selected images and display a final dialog telling you that it is finished.


Both scripts have been tested and run on Mac OS X Leopard 10.5.2 with Aperture 2.0 and Aperture 1.5.6 and ExifTool 7.13. They should also work with Mac OS X Tiger. You may have to recompile the scripts with the Script Editor.

As provided, the scripts ask for the following Exif data: LensID, ShootingMode, MeteringMode, ExposureMode, ExposureProgram. The LensID tag is not requested for Aperture 2.0 (if you use the RAW 2.0 converter Aperture will give you the Lens Model).
You only need to change the AppleScript property DesiredEXIFData if you want other information. Everything else should be done automatically.

ApertureDeleteCustomMetaData

A side effect of working on these scripts is the discovery of how to delete custom metadata. Just set the value of the tag to an empty string and Aperture will delete the tag. You can delete one custom tag at a time. The script asks for a custom tag name to delete and then deletes the tag from all selected images.

ApertureShowExif

This script translates the numbers that Aperture (2.0) gives for EXIF data MeteringMode, ExposureMode, ExposureProgram to the strings that ExifTool produces. This script is for Aperture 2.0.

Requirements

To use the first two scripts you will also need ExifTool, which can read, write and edit meta information in image files. The commandline program sqlite3 is standard on Mac OS X Tiger and Leopard.

Download and Install

I provide plain text Applescript files (with extension .applescript) and compiled scripts (with extension .scpt). You can run the scripts in two different ways.
  1. If you put the compiled AppleScript files in ~/Library/Scripts/Applications/Aperture you will be able to access the scripts from the Script Menu when Aperture is running (I use the excellent FastScripts). The disadvantage of placing them in the Script Menu is that you don't get any error messages if something goes wrong; luckily FastScripts will give you feedback if errors occur.

  2. If you put them somewhere else you'll have to load them in the Script Editor and run them directly in the Script Editor. If errors occur, the Script Editor will inform you.
The scripts are available for Aperture 2.0 and Aperture 1.5.6.

Download (Aperture 2.0)

Download (Aperture 1.5.6)

If you find any bugs or have a request you can contact me. See my home page for my email address.

Update 25 February 2008 Do not use the scripts for version 1.5.6 with Aperture 2.0. The structure of the library has changed.

Disclaimer

The usual. I have run and tested these scripts. They work for me. If you find bugs or errors, let me know. I am not responsible if anything goes wrong. Make sure you have a backup of critical stuff on your computer.