Find Images of certain size

Started by mikechin, August 08, 2024, 09:39:33 PM

Previous topic - Next topic

mikechin

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

StarGeek

#1
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.

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

"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

mikechin

Thank you! It was a Powershell 'issue' - switching to cmd gave the expected results.