Find images by size: find / file / awk

exiftool -q -r -ext png -if '$ImageHeight > 500' -p '$Directory/$FileName' .

i know this is a bit overkill but, this will work every time (even if there are spaces in your filename) and regardless of how file displays the information.

find . -name '*.png' -exec file {} \; | sed 's/\(.*png\): .* \([0-9]* x [0-9]*\).*/\2 \1/' | awk 'int($1) > 500 {print}'

and it prints the dimensions of the picture and the file

explaination:

  1. find all files named *.png under . and for each do a file on it

  2. use sed to print only the filename and dimensions then re-order to print dimensions first

  3. use awk to test the first number (height of pic) making sure its greater than 500 and if it is print dimensions and file name, if not do nothing.


You can also use identify from ImageMagick:

find . -name \*.png -print0|xargs -0 identify -format '%h %f\n'|
awk '$1>500'|cut -d' ' -f2-

Or in OS X:

mdfind 'kMDItemFSName=*.png&&kMDItemPixelHeight>500' -onlyin .