I use Aperture for photo editing and processing, but prefer iPhoto for keeping a gallery of my pictures. For a long time, I used the built-in tools in iPhoto to "Import from Aperture Library". What I didn't know was that this only imports the preview image, which is at a quarter resolution and badly compressed. I now have a couple of years worth of albums with lots of metadata but crappy image quality. I'd like to replace the images with higher-quality versions from Aperture, without losing all of the metadata (tags, descriptions, faces, etc). What's the easiest way to do this?

Related question: is it possible to access/change the image data in iPhoto with AppleScript? I can write a script to match images and replace them, if there's a mechanism to do that.

1 Answer
1

Here's how I eventually solved this problem. It took a few steps, and requires some scripting and command line hackery, but it did the trick.

Export the pictures you want to update from Aperture to a folder, say ~/Pictures/Updates

Open the album in iPhoto

Use this AppleScript to get a list of filenames for the master images

set output_filename to "/Users/user/Pictures/album.txt"
tell application "iPhoto"
set pics to photos in current album
do shell script "echo \"# Current album contents\" > " & output_filename
repeat with pic in pics
set picpath to image path of pic
do shell script "echo " & picpath & " >> " & output_filename
end repeat
end tell

Using any text editor, save the script below to update_pics.sh and mark it executable (chmod 755 update_pics.sh on the command line)

To use the script, give it the location of the updated pictures, a folder to put backups (I'm paranoid of losing data) and then pipe in the file generated before. For example:

update_pics.sh Updates/ Backups/ < album.txt

If you haven't already, close iPhoto. Then restart it while holding down Option and Command. That should give you a dialog to rebuild the iPhoto. You should only need to rebuild the thumbnails, though you may want to rebuild everything else. More info on rebuilding the iPhoto Library from Apple

iPhoto will probably take a long time to rebuild the thumbnails, since it will redo all of them. You have a number of albums to do, it's probably best to update the pictures first, album-by-album, and then rebuild the library. That's what I did, and it worked pretty well.