5

I have recently, imported various photos from both iCloud Shared Album downloads and directly from my iPhone. The problem is that some of these photos are duplicates, however the iCloud Shared Album duplicates are exactly half the resolution.

Duplicate scanners I have tried fail detecting these duplicates because of their different resolution. Additionally, I want to make sure I delete the low-res versions.

Is it possible to batch-delete photos by resolution in Photos.app?

  • If anyone can answer Feb 11-12, I'll be willing to offer a +50 bounty to that answer – Downgoat Feb 11 '18 at 22:57
4
+50

You can identify low-resolution photos in Photos.app using AppleScript and collate them into a single album that would then allow you to select them all in one go for deletion.

Ordinarily, this code snippet (run from inside Script Editor) would find the low-resolution photos (and videos) and put them into a new album called "Low Res":

    tell application "Photos" to add ¬
        (every media item whose ¬
            (height > width and height ≤ 480) or ¬
            (width > height and width ≤ 480)) to ¬
        make new album named "Low Res"

However, on MacOS 10.13 with the latest updates installed, it throws an error, reporting that it can't retrieve the specified album. This is probably a bug in Photos.app.

So, I decided to assign a description to all of these media items instead:

    tell application "Photos" to ¬
        set the description of ¬
            (every media item whose ¬
                (height > width and height ≤ 480) or ¬
                (width > height and width ≤ 480)) to ¬
            "Low Resolution"

    display alert "Done."

Then, within Photos.app, I created a Smart Album with the following search criterion:

Smart Album Criteria in Photos.app on MacOS

After clicking OK, the album was populated by the photos (and videos) that were marked as being of low-resolution.

Now, assuming there's nothing in there you'd like to keep, you would simply press Cmd+A to select all of the items, then Cmd+ to delete them all from the library (it actually moves them to the library's Recently Deleted folder, meaning you can retrieve any items you didn't intend to delete).

A couple of notes:

If you don't want video files to be included in the cull, then use these criteria for the smart album instead:

Smart Album Criteria in Photos.app on MacOS to exclude video files

Note the match selection is set to all. This excludes videos and gives you an album populated only by photos of low resolution.

Finally, bear in mind that the AppleScript has to search through your entire library and compare the height and width of every item it comes across. Depending on your library size, it can take a few minutes.

My Photos.app library has 8000 photos in it and it took about three minutes to on a MacBook 1.2GHz m5 to complete.

If Script Editor times out, wrap the code inside a timeout block and specify a length of time in seconds to allow the code to run to completion:

    with timeout of 300 seconds
        tell application "Photos" to...
        ...etc...
    end timeout

    display alert "Done."
  • Thanks! This worked great. SE doesn't allow me to bounty the question until Tuesday, but I'll bounty it when it lets me. One odd thing is that my photo library is around 6000 photos and it only took 3 seconds to execute, not sure what could be the cause for this discrepancy. – Downgoat Feb 12 '18 at 1:07
  • Great, thanks. Re: 3 seconds, I'm clearly using a very underpowered MacBook. – CJK Feb 12 '18 at 1:09
  • Started bounty but SE apparently needs me to wait 24hours before rewarding it – Downgoat Feb 14 '18 at 23:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .