The Image I/O class provides a simple way to save images in a variety of image formats in the following example:
static boolean ImageIO.write(RenderedImage im,
String formatName,
File output) throws IOException
Note: The BufferedImage class implements the RenderedImage interface. .
The formatName parameter selects the image format in which to save the BufferedImage.
try {
// retrieve image
BufferedImage bi = getMyImage();
File outputfile = new File("saved.png");
ImageIO.write(bi, "png", outputfile);
} catch (IOException e) {
...
}
for more information please look at this example.