HI, I want to save a buffered Image as an object to a file ,later convert it to a jpeg or gif file on the user's request.There is an advantage in this method since the user can't view the file directly since it is saved as a buffered image.I also want to display this image in my JFrame,how can it be done?Please reply as soon as possible,awaiting your precious reply Nate. Happy middling with java. Netharam.:confused.
I'm not sure how you would save a buffered image to a file without setting the filetype... it would probably be better to save it as some default file type and convert it if the user requested. ( Besides, to save a BufferedImage object, you'd have to subclass it to implement Serializable, and write all the pixel values out to a file or something... believe me... getting it to save as a default file type is easier... )
To display your Buffered Image to the screen is easy... just put it in an ImageIcon, put that ImageIcon on a JLabel, and put the JLabel on a JFrame... here's the code...
If you wanted to display a saved image file you could just put the image file's filename in the ImageIcon constructor instead.
-Nate
-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.