Get the dimensions of image using the terminal in Linux
ID: 337
Category: Linux Terminal
Added: 18th of February 2023
Views: 1,257
Sometimes you might want to find out what the dimensions of an image are. One quick way to do without opening any applications is to use to file command in the terminal
To get the dimensions of an image on my desktop I entered the following command
file image1.jpg
Output
Desktop/image1.jpg: JPEG image data, Exif Standard: [TIFF image data, big-endian, direntries=6, xresolution=86, yresolution=94, resolutionunit=2, copyright=(c) Alterfalter | Dreamstime.com], baseline, precision 8, 2122x1412, components 3
Looking at the output I can see that the image is 2122px Width x 1412px Height
Another way is to use the identify command which comes from the ImageMagick set of tools
identify image1.jpg
Output
image1.jpg JPEG 2122x1412 2122x1412+0+0 8-bit sRGB 1.75887MiB 0.000u 0:00.000
Related Tips & Tutorials
➔ Batch resize images in Linux using imagemagick and the terminal