AppleScript program to find duplicate JPGs in Apple Photos

When Apple moved to HEIC (a more efficient file format for photos) a few iOS versions ago (I can’t remember when, exactly) they created a very confusing situation where sometimes photos would be converted (if you had an arcane setting buried deep in iOS set a certain way) when you export them from your iPhone or Mac, and sometimes when you import from the iPhone to your Mac. And apparently Apple confused themselves, most of all, because many users (including myself) have reported mysterious double copies of photos cropping up in Apple Photos where a JPG version sits alongside the HEIC version. Obviously, nobody in their right minds wants this, so it appears to be some sort of bug.

Most people don’t care, but people with certain OCD tendencies–which is probably the target demographic of Apple, to be honest–are really bugged by this. So, in the spirit of mental health I wrote an AppleScript to find any photo where there is both a JPG and an HEIC version with the same file name, and put the JPG version into a special album for you to review and potentially delete. You can find the script here:

Photos AppleScripts

To run the script from inside Script Editor is fairly simple. Select a bunch of photos in Photos (you probably don’t want to try to run through groups of more than 2500 at a time) and then run the script. It will take a minute or so and will then create an album of the duplicates. If you end up having a bunch, Photos may ask you to confirm you actually want to do this (so, if the script appears hung, it may be Photos waiting for your input). Good luck!

Leave a Reply

Your email address will not be published.