Category: Linux Terminal

Added: 18th of February 2023

Viewed: 733 times

Related Tips & Tutorials

Batch resize images in Linux using imagemagick and the terminal

Get the dimensions of image using the terminal in Linux

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

Desktop/image1.jpg: JPEG image data, Exif Standard: [TIFF image data, big-endian, direntries=6, xresolution=86, yresolution=94, resolutionunit=2, copyright=(c) Alterfalter |], 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

image1.jpg JPEG 2122x1412 2122x1412+0+0 8-bit sRGB 1.75887MiB 0.000u 0:00.000