Martin Probst's weblog

Exporting from iPhoto to Picasa Web

Saturday, January 14, 2012, 11:16 — 1 comment Edit

I have a significant collection of photos on my home machine, all stored in iPhoto. I back them up to an external hard drive, using time machine, and copy them to a second machine using rsync every now and then. However all of that is within my apartment. That’s not only somewhat dangerous (think fire, burglary, … - at least if you’re paranoid enough), it also means I cannot access the photos from anywhere.

So my current weekend project is to upload them to Picasa Web. I actually like iPhoto, and I don’t really want to switch to Picasa to manage my photos, so I have to get the pictures out of iPhoto into Picasa Web.

Google has two tools for that, a standalone uploader, and an export plugin for iPhoto (that curiously lives in a completely different place of the UI than iPhoto’s other export plugins …). Both are available in a single download here. Neither of them does what I want though - the standalone uploader doesn’t understand iPhoto or its albums at all, and the iPhoto plugin is a manual process. You select individual albums and upload them. That’s probably useful if you want to export a single album, but not for a complete export. I need a background task that automatically does the uploading, preferably a restartable one.

Background process, automated? Command line to the rescue! :-)

It turns out there’s a very straightforward iPhoto export tool that also supports incremental exports, exportiphoto on Github. Downloading that and running exportiphoto -d “$HOME/Pictures/iPhoto Library” $HOME/tmp/iphotoexport worked like a charm (-d to suppress dates prepended to the event name). Some ~5 of my pictures were referenced in the album metadata but inexplicably missing on the hard disk, I simply deleted them.

This leaves you with a directory structure of “$event/$picture” in tmp/iphotoexport for each of your events (unrelated: why is this not a built-in feature of iPhoto?). Now for the uploading part - uploading to Picasa is surprisingly easy using the Google command line. It requires the Google client libraries, but both are available in Python’s easy_install repository, so simply running sudo easy_install googlecl gives you all you need. Creating an album from a set of pictures is as simple as google picasa create “My Album” my_album/* –date=2012-01-03. We can get the date for the album from the minimum last modified time of all exported files in the album using some ruby trickery, the dates of the pictures themselves are taken from the photo metadata. The command line uses OAuth 2 to log you in, which is a bit spooky - it pops up a browser in which you give the permissions, and then proceeds on the command line. Nice to see OAuth working so well, I really have to find some time and understand that.

So TL;DR:

curl https://raw.github.com/BMorearty/exportiphoto/master/exportiphoto.py > exportiphoto.py
sudo easy_install googlecl

python exportiphoto.py “Pictures/iPhoto Library” “tmp/iphotoexport” cd tmp/iphotoexport

for album in ; do echo Uploading $album… min_last_modified=ruby -e 'require "time"; puts Dir[ARGV[0] + "/*"].map { |x| File.mtime(x) }.min.strftime("%F")' "$album" google picasa create “$album” $album/ –date=$min_last_modified done

As for the incremental, resumable part, I still have no idea. I’ll poke around with the Google command line and see if I can get last modified timestamps or something similar out of it.


We had a power outage in our house when we were on vacation and couldn’t ssh to our server, which is scary since you don’t know what’s going on. Since then, we signed up for CrashPlan to backup all our data to the cloud. It backs up Macs, Linux and Windows systems. Still use TimeMachine and rsync for backups at our home between systems, but CrashPlan is for when everything goes.