Aspect Ratio config file

Started by StarGeek, May 31, 2016, 07:36:55 PM

Previous topic - Next topic

StarGeek

After reading a post on Reddit where someone wanted to find files that weren't a certain aspect ratio, I was curious as to what could be done with Exiftool.  A quick google brought up some code and I was able to make a config file out of it.  It finds the lowest common denominator and uses that to get the lowest integer ratio.  No decimals involved, so if you want to find something like 2.35:1, you'll have to figure something else out.

Sample output
======== X:/!temp/Test4.jpg
Aspect Ratio                    : 1749:1205
Image Size                      : 1749x1205
======== X:/!temp/Test4.mp4
Aspect Ratio                    : 16:9
Image Size                      : 1280x720
======== X:/!temp/RCNX0001.JPG
Aspect Ratio                    : 16:9
Image Size                      : 3776x2124
======== X:/!temp/IMGP0852.jpg
Aspect Ratio                    : 4:3
Image Size                      : 2592x1944
======== X:/!temp/IMG_0938.JPG
Aspect Ratio                    : 1:1
Image Size                      : 59x59
    5 image files read
* 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).

Phil Harvey

Interesting math.  Looks like fun.  Don't tell me why it works... I want to figure it out myself when I get a chance. :)

- 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 ($).

StarGeek

Quote from: Phil Harvey on May 31, 2016, 09:04:58 PM
Don't tell me why it works... I want to figure it out myself when I get a chance. :)

I have no idea how it works, but it's apparently Euclid's algorithm.  As usual, I just copied the code from elsewhere.
* 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).