Hi all,
I am wondering if there's a wiser way to get the image object's width and
height, please advise.
Here is my idea:
new ImageIcon(image_object).getIconWidth();
new ImageIcon(image_object).getIconHeight();
VisionSet - 23 Dec 2003 18:09 GMT
> Hi all,
> I am wondering if there's a wiser way to get the image object's width and
[quoted text clipped - 3 lines]
> new ImageIcon(image_object).getIconWidth();
> new ImageIcon(image_object).getIconHeight();
If you mean wiser in the sense that you don't need to load the image into
memory.
Then yes, if that is all you need to do then use the ImageIO package
specifically You need an ImageReader for the image format you have:
javax.imageio.ImageIO.getImageReadersByFormatName(String formatName)
and then you use the two methods:
javax.imageio.ImageReader.getHeight()
javax.imageio.ImageReader.getWidth()
These will read only as much of the file as is necessary to determine these
attributes.

Signature
Mike W
ak - 23 Dec 2003 22:09 GMT
http://reader.imagero.com
Andrew Thompson - 23 Dec 2003 22:46 GMT
> Hi all,
> I am wondering if there's a wiser way to get the image object's width and
> height, please advise.
http://www.geocities.com/marcoschmidt.geo/image-info.html
--
Andrew Thompson
* http://www.PhySci.org/ PhySci software suite
* http://www.1point1C.org/ 1.1C - Superluminal!
* http://www.AThompson.info/andrew/ personal site