Create an album of thumbnail size photos from Apple Photoslibrary

Started by kkaiser, April 06, 2020, 12:11:18 PM

Previous topic - Next topic

kkaiser

I have a large Apple OS X photoslibrary that has possibly thousands of small photos 240x180 and smaller. How can I scan for these and move them all to an album in the same photoslibrary?

StarGeek

I wouldn't know how to move them to a different album, but to scan for images 240x180 and smaller and move them you would use a command like this

exiftool -if '$ImageWidth<=240 and $ImageHeight<=180' '-directory=/path/to/new/directory' /path/to/source/images/
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

kkaiser

I tried this entry;

exiftool -if '$ImageWidth<=240 and  $ImageHeight<=180' '-directory='/Volumes/Photos\ by\ Year/photos-by-year/2019-Small' /Volumes/Photos\ by\ Year/photos-by-year/2019-D/

But the system immediately responded with:
quote>

Thats all it said, so I tried putting single quotes around the source file as well but I got the same response.

StarGeek

Quote from: kkaiser on April 06, 2020, 12:31:57 PM
I tried this entry;

exiftool -if '$ImageWidth<=240 and $ImageHeight<=180' '-directory='/Volumes/Photos\ by\ Year/photos-by-year/2019-Small' /Volumes/Photos\ by\ Year/photos-by-year/2019-D/

I think your quotes are off. You seem to have an extra quote in the directory part.

Maybe this?
exiftool -if '$ImageWidth<=240 and $ImageHeight<=180' '-directory=/Volumes/Photos by Year/photos-by-year/2019-Small' '/Volumes/Photos by Year/photos-by-year/2019-D/'
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

kkaiser

Looks like it must have been the '\' in the directory name. Thank you, this is now working.

StarGeek

The backslashes are fine if they're not enclosed in quotes (not sure if they work if there are quotes around them).  But notice that you have three quotes in this section
'-directory='/Volumes/Photos\ by\ Year/photos-by-year/2019-Small'
That's what messed it up.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

kkaiser


kkaiser

@StarGeek Going back to my original note I was hoping to run my script against the entire photoslibrary like this;

exiftool -if '$ImageWidth<=240 and  $ImageHeight<=180' '-directory=/Volumes/Photos by Year/photos-by-year/Small2' '/Volumes/Photos\ by\ Year/photos-by-year/PastYears.photoslibrary'

It responds almost instantly with;

1 directories scanned
    0 image files read

I know this is wrong because I can see hundreds of photos that are that size or less. I also tried with /originals on the end of the string but I got exactly the same response. Thoughts?

Phil Harvey

Do you see the jpg files with this command?:

ls '/Volumes/Photos\ by\ Year/photos-by-year/PastYears.photoslibrary'

If not, what is the directory that actually contains the image.  If they are inside a bunch of subdirectories in photoslibrary, then just add -r to the command to recurse into subdirectories.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

kkaiser

No this is what I get:

KKAISER@KeithsMacMini-2 ~ % ls '/Volumes/Photos\ by\ Year/photos-by-year/PastYears.photoslibrary'
ls: /Volumes/Photos\ by\ Year/photos-by-year/PastYears.photoslibrary: No such file or directory

Even if I add the /originals I get the same.

I think the issue is ExifTool doesn't work with the Apple photoslibrary which is some kind of construct.

Phil Harvey

I don't see how you come to that conclusion.  The ls command can't find the file you specify.  This has nothing to do with ExifTool.  "ls" is a system utility.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

kkaiser

@PHil_Harvey No,no, I'm sorry I misstated the issue. I thought maybe the issue was ExifTool not working with photoslibrary but it actually works fine. I wasn't talking about ls which I'm very familiar with. So sorry for my booboo.

My code looks like below with the results below that. But there are over 10,000 photos in this library that should be found and its not finding any. Any thoughts on that?

exiftool -if '$ImageWidth<=240 and  $ImageHeight<=180' '-directory=/Volumes/Photos by Year/photos-by-year/Small2' '/Volumes/Photos by Year/photos-by-year/PastYears.photoslibrary/originals/' -r

   17 directories scanned
110602 files failed condition
    0 image files read

Phil Harvey

Your condition works fine for me on MacOS.  I would say that there are no files in that directory which are this small.

You can try the command on a single known image to verify that it works.  For example:

% exiftool -if '$ImageWidth<=240 and  $ImageHeight<=180' -imagesize t/images/Writer.jpg
Image Size                      : 8x8


BTW, what ExifTool version are you using?  The current version is 11.83.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

kkaiser

Using version 11.93, I did your test and got:

% exiftool -if '$ImageWidth<=240 and  $ImageHeight<=180' -imagesize /Volumes/Photos\ by\ Year/photos-by-year/Small/24669387771.jpg 
Image Size                      : 64x96

Which is great, but the same image in the phototslibrary doesn't get moved. Hmmmmm!
I'm going to adjust the script a little and try it again.

kkaiser

I ran the following script and again had no files moved, yet over 10,000 are in the 110,602.

% exiftool -if '$ImageWidth<=240 and  $ImageHeight<=180' '-directory=/Volumes/Photos by Year/photos-by-year/Small2' -r '/Volumes/Photos by Year/photos-by-year/PastYears.photoslibrary/originals/'
   17 directories scanned
110602 files failed condition
    0 image files read