Main page > Java > Image FAQ

How can I find out about width and height of an image in a file?

<< Previous question: Java graphics without X server

Next question: Save component as file >>

I've written a class called ImageInfo that I've contributed to the Public Domain. Visit the ImageInfo page to find out more and download it. It understands quite a few image file formats and can also retrieve color depth, comments, physical resolution and number of images in a file (not all of this information may be available in all files).

You could of course load the image and call getWidth and getHeight on your Image object. However,

That can all be avoided by using ImageInfo.