Posted By:
olivier_saugeon
Posted On:
Wednesday, June 23, 2004 03:02 AM
You should use the javax.imageio.ImageIO Class :
ImageIO.write( myImage, theImageFormat, theOutputStream);
myImage should be a BufferedImage,
theImageFormat should be "JPG" or "PNG",
theOutputStream sould be an OutputStream.
an example :
// read an image form myImage.png file
BufferedImage bufImg = new IconImage(myImage.png).getImage;
// prepare an output stream to newImage.png file
OutputStream out = new FileOutputStream(new File(newImage.png));
// write the image to the new file
ImageIO.write(bufImg, "PNG", out);