Click to See Complete Forum and Search --> : How can i get image dimensions using java?


Thilkumar82
09-02-2008, 03:09 AM
Hi,
i need to get image dimensions (250 x 450 pixels) ie height and width using FormFile(in struts upoload) object
or Is there any way to find the dimentions of the image in java?

Thanks & Regards,
Thilkumar

chazzy
09-02-2008, 07:14 AM
Once you have a handle of the image (ie you read it into memory) you can use java.awt.Image to do this. http://java.sun.com/j2se/1.4.2/docs/api/java/awt/Image.html

Thilkumar82
09-02-2008, 07:32 AM
Thanks ,

Here i have FormFile (Struts file object)..
How can i get image dimensions?
what is ImageObserver .. how can i use this?
can u give a sample for this?

when try this ..i am getting following error..
SYS Exception caught java.awt.color.CMMException: General CMM error517

Regards,
Thilkumar

chazzy
09-02-2008, 07:57 AM
without seeing what you did, no clue why you get an exception. you should be able to pass null as the observer.

Thilkumar82
09-02-2008, 08:20 AM
I tried null also.. even it gives Exception..only for some images..
and i saw in sun website that it is a bug in jdk..

Thanks ,
Thilkumar