Linux: display images type and size in command line

Front-end developers probably often need to verify the properties of some images like their type or their dimensions. To avoid firing Gimp or similar software just for a quick look, GNU/Linux distributions1 offer as usual handy tools like identify, coming from the ImageMagick suite.

$ identify /home/didier/images/myimage.jpg
/home/didier/images/myimage.jpg JPEG 502x482 502x482+0+0 8-bit sRGB 31.7KB 0.000u 0:00.000

You can of course use glob patterns to display several images at once:

$ identify /home/didier/images/gnulinuxrocks*
/home/didier/images/gnulinuxrocks.png PNG 54x84 54x84+0+0 8-bit sRGB 190c 1.6KB 0.000u 0:00.000
/home/didier/images/gnulinuxrocks-even-more.png[1] PNG 42x84 42x84+0+0 8-bit sRGB 187c 1.5KB 0.000u 0:00.000
/home/didier/images/gnulinuxrocks-arch-logo.jpg[2] JPEG 396x140 396x140+0+0 8-bit sRGB 7.14KB 0.000u 0:00.000

Don't forget to check the manual for many more options.

$ man identify

1 I know, ImageMagick is available on other operating systems but I prefer trolling... though installing it on a GNU/Linux distribution with a package manager is way simpler and safer!



No comment yet.

A remark, a suggestion? Do not hesitate to express yourself below. Just be courteous and polite, please.

If this field is left blank, you will appear as Anonymous.