12 How to find image width and height?

Can use the file command. But the ouptput has to be parsed. easier to use imageinfo

>sudo apt-get install imageinfo  #install if needed 
>w=`imageinfo --width foo.png` 
>echo $w 
81 
 
>h=`imageinfo --height foo.png` 
>echo $h 
24
 

Reference:

  1. http://stackoverflow.com/questions/4670013/fast-way-to-get-image-dimensions-not-filesize