Tag Archives: iPhoto

iLife 09: iPhoto

I have a confession to make: until this year, I didn’t have all my photos in a properly cataloged database. I’d tried various programs, but none of them quite satisfied me.

iView MediaPro seemed to have bugs in its ITPC handling. I e-mailed their support address reporting the problems, and got no reply at all. Then they were bought by Microsoft, so that was that.

QPict works well as a browser for large numbers of random files, but I don’t find it a very helpful tool for organizing them. This seems to have been reflected in the changes in the new version, which looks more like a Finder replacement for photos.

I got Adobe Bridge for free with Photoshop Elements, but I gather it’s pretty much the full deal as bundled with Photoshop CS3. It looks like it’s very powerful, with some kind of metadata templating system. However, it has a horrible interface for browsing large numbers of photos, and a horrible interface for entering metadata.

iPhoto was pretty ropey too. In particular, it insisted on moving all your photos into a set of folders named 2004/01/01, 2004/01/02, and so on. It also had no support for any of the industry standard metadata formats, such as ITPC and XMP. It’s as if iTunes had been built with no ID3 tag support and made to store all your music in folders according to how many minutes and seconds long each song is.

However, with iTunes 08, Apple finally delivered something usable; and with iTunes 09, I’m actually feeling enthusiastic about the program. I’ve now got everything in iPhoto, and I’m happy with it.

The new face recognition is far from perfect, but it’s good enough to be a time saver. It can also be a source of entertainment–I laughed when it got confused by some shadows, picked out a horse’s ass, and asked whose face it was.

The geotagging isn’t too useful as yet, but it’s a nice feature to have supported. I’ve discovered that if you’re using the dialog to manually assign geotags, it will use any existing metadata to help narrow down the options it presents to you. This means that if you start off by tagging a bunch of photos with an approximate location (e.g. London), and give the event a sensible title (e.g. England Trip 2001), searches for specific locations will apparently start from London, England and work outwards.

Browsing the tagged photos is less impressive. For now, there’s just a zoomable Google map with push pins on it. However, I’m sure people will start coming up with cool add-on visualizations.

Another nice feature of iPhoto is the built-in Flickr and Facebook support. Both systems work like add-on photo libraries; you can edit a Flickr-published photo album, and the changes automatically sync up in the background. Also, any faces tagged in iPhoto result in the appropriate person being tagged in Facebook.

Internally, the iPhoto Library now organizes your files by event. As in previous versions, the original files are kept untouched, and any changes you make result in new files. All of this is invisible to you, and you don’t need to care, but it does mean that you never lose quality by applying repeated edits to a JPEG, and you can revert to the original file at any point. The program manages to stay pretty snappy, even while juggling thousands of files.

iPhoto now supports the raw CR2 files from my Canon SLR, as well as JPEGs. It also has an option to reveal the original file in the Finder, or to fire up an external program (such as Photoshop or Canon Digital Photo Professional) to edit the raw file.

So overall, I now recommend iPhoto, even for fairly advanced photography enthusiasts. It won’t be enough for a pro studio photographer, but if your camera isn’t your career, it’s probably most of what you need.

Scripting iPhoto 09 with Ruby

I upgraded to Apple iLife 09. My main motivation was to get the new version of iPhoto, which adds support for face recognition and GPS integration.

When I fired up the new iPhoto, I discovered that the GPS data for my images in JPEG format had been read in correctly; but that all of my Canon raw CR2 files had been ignored, even though the photos of Hamburg mostly had GPS data.

I investigated whether iPhoto was scriptable. If I could add the GPS coordinates to the existing photos via AppleScript, I could take the GPS track logs and build an importer. Unfortunately, though, there’s no AppleScript interface to the GPS metadata, according to iPhoto’s AppleScript dictionary.

Experimenting further, I discovered that if I rooted around inside the iPhoto library (using right click and "Show contents"), copied the CR2 files out, and imported them into iPhoto again, that the GPS data would be processed correctly.

There was a snag, though. If I did that, I would lose all the names and descriptions I had entered in iPhoto. This was a solvable problem, though: iPhoto remembers the original filename, and has AppleScript properties that let you read and write the description/comment and name/title of any image.

The next small snag was that I don’t know AppleScript. I’ve tried to learn it, but I find it very annoying and syntaxy. I considered giving it another go, but I did a few quick Google searches and determined that AppleScript lacks hashes, arrays, and most other useful data structures that you might use to store and retrieve a set of captions for a large number of photographs indexed by filename.

Ruby to the rescue. When Apple created AppleScript, they did it by layering it on top of a lower level system called OSA or Open Scripting Architecture. This is a language-independent API, which means that you can glue any scripting language to it, and instantly be able to do anything in that language that you can do in AppleScript. There are a couple of projects which link OSA to Ruby; I picked RubyOSA , though a brief exploration of rb-appscript (a port of a Python bridge, spit ) suggests that it would have done the job too.

A quick sudo su and gem install ruby-osa , and I was ready to script iPhoto using Ruby. I built two scripts. The first, iphotodump.rb , dumps out all the titles and comments for the selected photos, storing them in data files using Ruby’s standard marshalling (persistence) mechanism. The second script, iphotorestore.rb , reverses the process: it reads in the data files, then scans through the selected images and restores the appropriate metadata by matching up the filenames of the original image files.

I ran iphotodump to dump out all the metadata for my Hamburg photos, deleted them from iPhoto, re-imported the CR2 files, then ran iphotorestore to restore the metadata. Problem solved.

I imagine there are other people out there with similar iPhoto-related metadata problems, so hopefully my scripts can point the way at solutions. With iPhoto glued to Ruby, there are all kinds of possibilities–for example, you have the power to do a full regular expression search and replace, with Perl-like regular expression power. I think I’m also going to write something to append the photo’s keywords to the description, so I can then go on a keyword deleting spree but still be able to find photos using search.