ExifTool Forum

ExifTool => Newbies => Topic started by: mikechin on August 08, 2024, 09:39:33 PM

Title: Find Images of certain size
Post by: mikechin on August 08, 2024, 09:39:33 PM
I'm trying to move images of a certain height. I'm on windows. I have two images in the directory im working in and  I get his behavior:

This matches both
exiftool -q -filepath -if "$imagewidth * $imageheight >= 0" .

These match none
exiftool -q -filepath -if "$imageheight >= 0" .
exiftool -q -filepath -if "$imagewidth >= 0" .

this matches both even though it shouldn't (?) based off their size
exiftool -q -filepath -if "$imagewidth * $imageheight == 1000500" .

What is going on?

Ultimately I want this to work 

exiftool -if "$imageheight==1334" -filename .

but it fails even though there is an image with height 1334

Thanks in advance
Title: Re: Find Images of certain size
Post by: StarGeek on August 08, 2024, 10:49:34 PM
What OS?

Your commands are for Windows CMD. On Mac/Linux, you need to use single quotes around any option that includes a dollar sign $.

If you're using Windows PowerShell, single quotes will work in this case, but understand that some exiftool commands will fail regardless of how it is quoted. See this post (https://exiftool.org/forum/index.php?msg=80581).

Examples on Windows CMD using an image 1749x1205 (2,107,545 pixels)
C:\>exiftool -G1 -a -s -imagesize y:\!temp\Test4.jpg
[Composite]     ImageSize                       : 1749x1205

C:\>exiftool -q -filepath -if "$imagewidth * $imageheight >= 0" y:\!temp\Test4.jpg
File Path                       : y:/!temp/Test4.jpg

C:\>exiftool -q -filepath -if "$imageheight >= 0" y:\!temp\Test4.jpg
File Path                       : y:/!temp/Test4.jpg

C:\>exiftool -q -filepath -if "$imagewidth * $imageheight == 2107540" y:\!temp\Test4.jpg

C:\>exiftool -q -filepath -if "$imagewidth * $imageheight == 2107545" y:\!temp\Test4.jpg
File Path                       : y:/!temp/Test4.jpg

C:\>exiftool -q -filepath -if "$imagewidth * $imageheight == 2107550" y:\!temp\Test4.jpg

C:\>

C:\>exiftool -if "$imageheight==1205" -filename y:\!temp\Test4.jpg
File Name                       : Test4.jpg

Title: Re: Find Images of certain size
Post by: mikechin on August 08, 2024, 11:47:05 PM
Thank you! It was a Powershell 'issue' - switching to cmd gave the expected results.