How to replace images in iPhoto with higher quality versions?
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\" &gt; " &amp; output_filename
    repeat with pic in pics
        set picpath to image path of pic
        do shell script "echo " &amp; picpath &amp; " &gt;&gt; " &amp; 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)

#! /bin/bash
# a quick script to parse in a series of filenames, and update them

input_folder="$1"
backup_folder="$2"

if [ "$#" -ne 2 ]; then
        echo "Usage: $0 [folder with new images] [folder for backups]"
        exit 0
fi

if [ ! -d "$input_folder" ]; then
        echo "Can't read input follder $input_folder"
        exit -1
fi

if [ ! -d "$backup_folder" ]; then
        mkdir -p "$backup_folder"
fi

if [ ! -d "$backup_folder" -o ! -w "$backup_folder" ]; then
        echo "Can't write to backup folder $backup_folder"
        exit -1
fi

while read line; do

        # skip empty lines or comments
        [ -z "$line" -o "${line:0:1}" = "#" ] &amp;&amp; continue

        if [ -f "$line" ]; then
                filename=`basename "$line"`
                input_file="$input_folder/$filename"
                cp "$line" "$backup_folder"
                if [ -f "$input_file" ]; then
                        echo "Replacing $filename"
                        cp "$input_file" "$line"
                else
                        echo "Could not find input file $input_file"
                fi
        else
                echo "$line does not exist"
        fi
done

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/ &lt; 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.