How to backup your iPhoto library to Dropbox – and resize images to save space


iphoto-library-finder-infoIf, like me, you took Steve Jobs at his word when he said iPhoto 6 onwards could support up to 250,000 images, and you’ve been piling them in ever since, you’ve probably got a very large iPhoto library.

Mine is currently sitting at 66,431 images and is 220GB on disk. It’s so big that it convinced me to part with $1800 (Australian) to get the 512GB SSD Apple is making an option with the latest MacBook Pros. Obviously, at that price, it’s a ludicrously overpriced option at $3.50/GB compared to smaller, cheaper SSDs, typically around $2.50/GB, or mechanical hard drives at about $0.14/GB, but I wanted to have a boot drive on which I could have my full iPhoto library so I could work with pictures much more quickly (and boy, does it make a big difference.)

However, one problem I’ve been seeking an answer to for years now is how to backup my photos off-site, in case a house fire takes out both my MacBook Pro and my Time Capsule backup. (Or, if my house was burgled and both the MacBook Pro and Time Capsule were stolen — which actually happened to a family member of mine.)

Simply dropping the iPhoto library into an online backup program like Carbonite or Mozy isn’t viable, because uploading 200GB of data takes so long that it basically never completes — or the backup system gets so far behind that you’d be losing a lot of new photos if your house burned down.

The ‘ideal’ solution I had in mind was to do Time Machine backups constantly to my Time Capsule, as well as a fallback backup of downscaled resolution photos to an online backup location. I like Dropbox (my referral link included in that link) because it works so quietly and reliably in the background, but you could use any online backup service. Although some people might say that backing up the full resolution photos is important to them, to me, the most important thing is making sure those frozen memories don’t get lost — and if I downscale them to fit within 1920x1920px, then I still have a high definition, albeit not camera-resolution, version of the photo.

I’ve now figured out how to do it! Full details after the jump.

I found a great tool to do this called Phoshare, created by Google! Tilman Sporkert, who works for Google in San Francisco, created the tool in his “20% time” — the time Google employees get to pursue projects of interest to them and the community.

Tilman says he likes managing his photos in iPhoto, but doesn’t like the fact that iPhoto effectively holds his photo library prisoner in its application-managed bundle file. He wanted to make a tool that could sync the photos to a different location to be used in other photo tools as well like Google Picasa or with home theatre boxes that could only read pictures from a file tree.

“I like managing and editing my photos with iPhoto, but I don’t like having my work kept hostage inside iPhoto. I also like Picasa from Google, for its speed and easy management of online albums (check out the “Sync to Web” feature), and it’s ability to automatically discover images, even if stored elsewhere on your network. And sometimes I feel like using Adobe Bridge. So it’s important to me that any work I invest into my photo collection (edits, organization, annotations, tagging) is not tied up in one application. That’s where phoshare comes in. I’ve used variations of this tool for many years,” he writes on the Phoshare project homepage.

The GUI for Phoshare makes doing this task — liberating pictures from iPhoto to another place — a piece of cake.


However, Tilman also built in the ability to rescale photos at the time they were synced — though this is not in the GUI; you have to do it via the command line. It uses the Core Image library which is a powerful Apple-supplied tool baked into OS X for processing images. Phoshare saves images at 90% JPEG quality, so you don’t lose visual quality, and it can also be set to export data on faces, star ratings, keywords, etc to the JPEG files for use in other programs.

With the correct command line options, you can create a duplicate copy of your iPhoto library in your Dropbox folder, which will then be synced to Dropbox’s servers (and other computers syncing with your Dropbox account) for safekeeping.

The other really great thing about Phoshare is that it is designed as a regular sync tool, rather than a one-time export tool (though it certainly can be used as that as well.) Once you have run it through your library once, you can run it again whenever you like and it will very quickly update your sync location with just new photos you’ve imported into iPhoto. (You can also set it to delete photos from the sync target that you have deleted from iPhoto.)

How to install Phoshare

You can install the Phoshare package easily from Tilman’s Google Code website. Image resizing is built in, but to get the metadata export aspect working, you’ll have to install one other third-party library first.

Here’s how:

1) Download and install ExifTool, which will give Phoshare the ability to write iPhoto’s faces, star ratings, keywords, event names etc into the EXIF data in the exported JPEGs. (EXIF data is the way cameras embed information into saved photos, but it’s equally useful for embedding info from iPhoto.)

2) Download Phoshare and move it to your Applications folder. Make sure you grab the latest version, 1.1 (or better — at the time of this article update, it was up to 1.4.5) because Tilman has built image scaling right into the app, which makes things a lot simpler than before.

3) Now’s the fun part — using it via the command line. Tilman has written up an explanation of all the command line options on his Scripting with Phoshare page, but here’s one I prepared earlier that will do the job of taking an iPhoto library in its default location and saving it to a folder in the default Dropbox location called “iPhoto backup”. It will downscale the images to a maximum size of 1920px in either height or width, and it won’t upscale photos that are already smaller than that.

/Applications/*MacOS/Phoshare* -e . -d -k -u --size 1920 --iphoto "~/Pictures/iPhoto Library" --export "~/Dropbox/iPhoto Backup"

To explain the command line to you, I’ve broken it down below:

export events from iPhoto.

export all events
delete photos from Dropbox that have been deleted from iPhoto since last export
write keywords into the exported files
update the exported files if they have been changed in iPhoto since last export
resize images when exporting
resize them to a maximum size of 1920 in either height or width.
specifies the iPhoto library location
specifies the export target location

There are many other command line options you could use, such as writing face data into the photos, exporting place names and GPS coordinates, and more. You can get a full list of the possible options by typing the following into a Terminal window:

/Applications/ -- help

4) Now wait; it’ll take many hours to process all your images (depending on how many you have). I found it took about one second per image processed — so with my 66,000 images, a quick Google calculation estimated an export time of 18.33 hours. I do have a fairly fast system though — a 2.66GHz Core i7 with 8GB RAM and an SSD drive, so your speed may vary.

Phoshare running in the Terminal, exporting images from iPhoto to my Dropbox folder:


I found Phoshare crashed a few times during export, but I was able to restart it and it would resume where it left off. If Phoshare crashes neatly it will output a debug log, which you can copy and paste into a bug report for Tilman to look at. He fixed one problem I encountered (crashing on images with no timestamp) within hours — huge thanks to him for that.

The resulting image files, exported at a max size of 1920×1920 had an average file size of 830KB, which means my 67,106 images took up 57.17GB. This is a bit too large to fit into a $10/mth Dropbox 50GB plan — but of course, you can tweak the image dimensions to get filesize down, or you could use another online backup tool that uses Amazon S3 storage (and therefore should have a similar upload speed to Dropbox).

Voila: the resulting exported photos in the Finder:


This, of, course, will take days to upload to Dropbox — I found I was able to upload about 5GB overnight with Dropbox averaging around 100KB/s upload speed, so I expect this will take somewhere between four days and two weeks to finish. Of course, the big advantage of Dropbox is that it never bugs you with error messages — it just sits in the background uploading away constantly, and never seems to crash or hang.

Thanks to Tilman for making this great tool — and having the foresight to include image scaling options even though it wasn’t really central to his personal needs. Three cheers for independent software developers turning out high quality freeware to fill the gaps left by commercial developers…!