Let's say there are 50 images, and I want to know which one has the biggest width. Which commands should I use?
12 Answers
This command (identify from ImageMagick) output the image with the biggest width :
identify -format "%w %h %f\n" *.png | sort -n -r -k 1 | head -n 1-format "%w %h %f = width, height, filename
Result : w h image.png
Source : Find Largest Image Dimensions in Folder :
If your images aren’t in the same folder, open a terminal and run this script from a folder contening subdirectories.
find . -iname "*.png" -type f -exec identify -format "%w %h %f\n" '{}' \; | sort -n -r -k 1 | head -n 1Note : If you have more than one image with the same width it will only show one result. To have a list of all images sort by width remove head -n 1 from the precedent command.
4This command will search for image widths in the current directory.
Before you have to install imageinfo with:
sudo apt install imageinfoThen type this command
find . -maxdepth 1 -type f -iregex ".*/.*\.\(jpg\|jpeg\|png\|tiff\|bmp\svg\)" \ -exec bash -c "echo -ne {}' '; imageinfo --width {}; echo " \;\ | sort -k2 -nIf you only want the largest one add a pipe to the command above
... | tail -n 1 1