I have some .jpeg images saved in a file in a cluster at school. I am at home using PuTTY to access one of the Debian nodes. I'm able to get to the folder with all the images but I need to see the dimensions of each one in order to run one more computation on them. Is there a way to do this?

In keeping with one of the fundamental rules of asking for help in computer programming, I should illustrate my ultimate goal. The objective was to take an input image and perform a singular value decomposition on it in order to see what happens as we truncate the image. With lower amounts of singular values used, the resulting images were blurry. I now need to determine the compression ratio for each image (ratio of output to input image file size). My intention was to look at the dimensions of each resulting image and divide the new width by original width and new height by original height. If anyone knows a better way to do this I'm all ears :)

Note: I do not have sudo privilege because it is a university computer, not my own.

3 Answers 3


I can only address the first part of your question: You can view the dimensions of an image on the command line by the using the identify tool, part of the the imagemagick package. (To install imagemagick on a Debian box, provided you have sudo privileges, you can run sudo apt-get install imagemagick ).

For example, in a directory with image file rose.jpg, running identify rose.jpg will produce a result such as:

rose.jpg JPEG 70x46 70x46+0+0 8-bit sRGB 2.36KB 0.000u 0:00.000

which shows you that the image's dimensions are 70px x 46px.

You can get even more information about the image by using the -verbose option, for example identify -verbose rose.jpg

You can view the documentation for the identify tool here: http://www.imagemagick.org/script/identify.php


There are number of tools that will do this:

If these programs are not installed, note that both jhead and jpeginfo are quite simple and presuming a compiler is available will be easy to build in your own user account.


You can use the commande file e,g:

file images.jpg

the output is something like :

images.jpg: JPEG image data, JFIF standard 1.01, aspect ratio, density 
1x1, segment length 16, baseline, precision 8, 342x147, frames 3


rdjpgcom -verbose images.jpg

sample output

JPEG image is 342w * 147h, 3 color components, 8 bits per sample
JPEG process: Baseline

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.