4

I have a few gigabytes of digital photos collected over the years in various directories. My current need is to look for photos in portrait mode as against landscape mode. I am trying to write a shell script with the help of the find and exif commands to see if I can get a list of images.

Portrait mode exif information shows that tag "Pixel Y Dimension" is larger than "Pixel X Dimension"

I have managed to get the right commands to get width and height of images:

exif -t 0xa002 image.jpg | grep Value | cut -d' ' -f 4 #Width
exif -t 0xa003 image.jpg | grep Value | cut -d' ' -f 4 #Height

How could I combine this with the find command so that I can find images where height is larger than width?

And, is there any way I can make it more generic - like find photos with certain date (in the exif data) or exif values?

Zanna
  • 72,312

1 Answers1

1

We can use a modified version of this answer: How to find all images with a certain pixel size using commandline?

find . -iname "*.jpg" -type f -exec identify -format '%w %h %i' '{}' \; | awk '$1<$2'