iPhoto AppleScript to Remove Duplicates
Short Story:
I had several years of photos that I needed to identify and remove the duplicate. Instead of manually combing through 12,000 (read Long Story below) and before carpal tunnel set in, I needed a script to help me out. My situation may or may not be unique, so this script may not work 100% out-of-the-box for you, but it should get you started.
To use:
- Download and unzip the script
- Double-click the script to open in Script Editor
- Go into iPhoto and select a group of photos you want to compare
- Switch back to Script Editor and run the script
- Don’t Touch Anything! Just let the script finish, it could take a while if you are comparing a lot of photos
- After the script is done, go back into iphoto and search for “duplicate”

- You can highlight all the duplicates and delete them or move them some place safe
Photos are considered a duplicate if:
- both heights match
- both widths match
- the photo date in iPhoto match, this is typically the EXIF creation date
Long Story:
42 Comments to “iPhoto AppleScript to Remove Duplicates”
Add Comments (+)-
Karl,
Thanks for your script.
I have developed your script a little further. How would you like me to acknowledge your work as I plan to attach GPL license to it?
Phil
-
Here is a link to my version of your script as well as a script to clear existing comments:
http://philatwarrimoo.blogspot.com/2008/11/iphoto-script-to-tag-duplicates.html
-
Great Script, worked great for me, thanks!
-
“it could take a while” … How long for an iPhoto library with about 10,000 photos?
-
Good scripts thanks all.
however the date usually doesn’t work especially when u have transfered and manipulated photos several times. I recomend using metadata which are not changed whatever happens. In addition, and it is important as applescript is slow, you ll reduce the nbr of tests to just this one as there are little chances are that 2 photos can have be taken at the EXACT same time – Especially is there is only one camera in the house! -
Thank you so much for putting this up. I just reformatted my computer ,but when I reintroduced my iphoto library it duplicated itself 4x. Your script saved me a chunk of sanity.
-
HELP! I ran your script on my album and now when I click on an image iPhoto only shows an empty placeholder with a question mark in it. the Thumbnails in the list looks alright though. Please tell me what to do!
-
Nice script! I ran it on a collection of about 17,000 items on an Intel Mac mini, which took about seven hours – just for everyone’s orientation. It found both duplicate photos and videos.
-
Your script sounds perfect, but I’m concerned about using it because there is no answer to Panic!’s question. Is there a solution for that issue?
-
Thanks very much for the script, appreciate the sharing.
-
Script works great. – but I keep getting a “Iphoto time out” error. When I do a large # of Photos (over 1,000). Any Idea what’s causing this. Do I have my screen saver kicking in too soon. Works if I touch the iPhoto application every once in a while.
-
Thank you so much! Works like a charm.
-
Great work. It’s literal, practical.
TESTED IN:
–mac os x v.10.5.8
–iPhoto v7.1.5 build 378I have a CAUTION response to the previous comment:
———————————-
ocayd Says:
September 24th, 2009 at 9:44 pm
———————————-If you’re concerned with the output of the script then do the following:
Take the “To use:” step-by-step instructions literally by testing with a a pair of 10 duplicates. If your paranoid about those losing those 10 pictures, then copy and paste them into a directory, or on your desktop.
Then, follow the “To use” instructions provided above.
-
Did work once, with the duplicate showing, and it did attach a new cronological name. Once I run it again it tells me it already fond the duplicates. I have a very large mess. 41,678 family pictures. Some 3 to 4 times. And a lost set of 2005 pict that were on a hd that is being shipped back to G-Tech. Please help me clean up my G4 imac 800mgz oldie but goody “dome”
Thanks -
I ran your program on my friends Mac Laptop. It ran said it was done. But none of the photos had comments or keywords of “duplicate, duplicates”. She has many duplicates The dups have matching titles. 2 and 3 of the same photos.
PPC G4 Tiger upgraded to Leopard using iPhoto 5
-
I’m with Tktim – I just ran this on one folder in iphoto with many duplicates; it ran for a minute and then told me all duplicates were marked. I checked, and none were marked.
Bummer!
(OS X 10.6.5)
-
Does the script add “duplicate” to BOTH photo descriptions or just one or the other? If the latter, does it put it on the “larger” file size version, as was required in your specific case? I would rather keep the larger (ie likely higher resolution version) file. Thanks!
-
I downloaded the script.
Selected the last import roll.
Duplicated one of the photos.
Ran the script and it told me all duplicates had been marked.
Nothing was marked that I could see and when I searched for “duplicate” noting appeared…Thanks,
-
First thanks for the script. It works but has some limitations. Photos need to be sorted by date. Looks for duplicates only up to the next photo. When photos are taken in burst shooting it marks as duplicates different photos taken within the same second.
Therefore I have improved the script by looking at the checksum and adding a count in the front window name.
Running 1000 photos takes about 6 minutes.
I would like to attach the script but how ?? Please help -
I get this error “error “iPhoto got an error: AppleEvent timed out.” number -1712″ reading this I assume I should use smaller batches of pics? Using latest iPhoto btw
-
check if sleep mode is not shorter than the time to run the script.
-
Works great! thanks! 1500 pictures in 2 minutes. (iMac 3.06 i3)
-
iPhoto 09, ver 8.1, OS X 10.5. Ran script on an old library first and it seemed to work. Ran it on my real library(3,500). When browsing photos, and I double click on the thumbnail, the photo displays as normal but I get the message: “The photo “P3310012.jpg” could not be opened, because the original item cannot be found.” I cannot drag some photos out of iPhoto. If I am browsing under “Events” rather than “Photos”, everything seems to work OK. How do I fix?
-
I don’t store my photos in iPhoto — is there any way of identifying the duplicates if they’re just stored under Pictures?
-
thanks so much for the script. it worked wonderfully!
-
Thanks,
I have used your script with some modifications.
It have been very usefull -
I’ve tried several times to run this script, and after many hours, I keep getting this error message:
–> error number -1712
Result:
error “iPhoto got an error: AppleEvent timed out.” number -1712Any ideas on how to fix?
-
Hi, great downloaded without any trouble and had my duplicates mark as ‘duplicate. Now here is the but ! As I have so many duplicates how do I delete them all in one go…..
-
thank you
-
3 years later and still works… thanks!
-
I started looking for duplicates yesterday using Annihilator, I have 13,000 and it is still running 22 hours later. Can this be right? I know I have a lot of duplicates in all shapes and sizes.
-
great script, seems to work unfortunately i get an error at one particular photo, seems to be looking for a photo that isn’t there anymore (i’m guessing it’s a particular photo that I either saw as a duplicate myself a while back or was pr0n). i’d restore the pic from a backup but let’s just say my external backup drive isn’t in working order at the moment. so the script is working fine until it gets to that one particular event date in iPhoto. i did the iPhoto Library rebuild already thinking that would solve the issue but i’m suspecting (though hoping not the case at all) perhaps the rebuild is what did it by pointing to a file that isn’t there anymore. help!
btw, although i’m not exactly computer illiterate, been on a mac for just over a year and a half and it’s only now that i’ve attempted dealing with issues i’ve become more accustomed to dealing with on Microsoft Windows machines, and scripting was never my forte back in college (which is almost a decade ago)
Thanks in advance.
-AbeMac OS X 10.7.2 on Mid-2010 MacBook, iPhoto ’09 ver 8.1.2
-
just to clarify, it’s working until that one file, which interrupts and prevent the script from going through the library any further.
-
Hi…simple question….does this script work with Aperture files – libraries?
thanks
LGH
-
I have done this and it marks a lot of them “duplicates” but I can’t find some of those photos (searching by date) in my regular library. I hate to delete them and lose some of them. Is there some way to find the original as opposed to the duplicate?
Trackbacks/Pingbacks
- Resuelve tus dudas 9: iPhoto, Mail, iChat, etc. | AppleNeXt
- how to make a perfect mystery professional script

