Home > Archive > Java Help > October 2005 > public boolean imageUpdate method of ImageObserver
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
public boolean imageUpdate method of ImageObserver
|
|
| saurabh.chakote@gmail.com 2005-10-26, 4:01 am |
| Hello Techies !
Actually I want to know about ImageObserver interface.
I just want to get the Height & Width of the Image.
I have an image in byte array
------------------------------------CODE--------------------------------
byte[] byteArr = new byte[fileSize];
//Create an input stream to read the uploaded file.
ByteArrayInputStream bytein = new
ByteArrayInputStream(fileData);
// Load the input stream into the byte Array.
bytein.read(byteArr);
// Close the input stream.
bytein.close();
java.net.URL imageurl =
this.getClass().getResource("fileUpload");
Image image = new
javax.swing.ImageIcon(imagePath).getImage();
int imageHeight=image.getHeight(
new ImageObserver() {
public boolean imageUpdate(Image img, int
infoflags, int x, int y, int width, int height) {
-----------------------
-----------------------
-----------------------
-----------------------
return false;
}
}
);
System.out.println("Image Size "+imageWidth+ "X"
+imageHeight);
--------------------------------------------CODE
ENDS---------------------------------------------------
I simply wants to get the size of the image specified by the
"imagePath"
Now my problem is
1.What should i write in the " public boolean imageUpdate(Image img,
int infoflags, int x, int y, int width, int height) " method
2. If there is problem with my implementation , what will be the right
way to do it ?
Happy Surfing :D
Saurabh Chakote
| |
| Roedy Green 2005-10-26, 4:01 am |
| On 25 Oct 2005 22:12:28 -0700, saurabh.chakote@gmail.com wrote, quoted
or indirectly quoted someone who said :
> Actually I want to know about ImageObserver interface.
to understand this you need to partly understand the whole system of
how Images get gradually loaded and rendered.
Have a look at http://mindprod.com/jgloss/image.html
and see if the answer comes clearer.
--
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.
| |
| saurabh.chakote@gmail.com 2005-10-26, 4:01 am |
| Roedy Green,
Thank you for reply and the gr8 link shared......
Saurabh Chakote
|
|
|
|
|