Image type and size from the Linux command line

Written by
Date: 2011-08-01 15:20:00 00:00

This is another small tip, but very useful for webmasters, you know that a webpage loads faster if you define the height and width of an image in the html code.

But what if you do not know that info of a given image?, you can always fire the GIMP or any other graphical application to check the size of a given picture but you can easily do it from the command line.

identify picture.jpg

The output of the that command may be something like this:

picture.jpg JPEG 1500x1000 1500x1000+0+0 8-bit DirectClass 104KB 0.000u 0:00.000

You now know that this is a JPEG file of 1500x1000 pixels, 8-bit depth and 104 KB.

It helps me a lot when adding pictures to this site.