dcsimg

How can I save an image to disk in a standard image format?

John Zukowski

The javax.imageio package provides this for you in Java 1.4. Previousl versions had no standard support, though you could add third party libraries to standard Java for this.

    BufferedImage output = new BufferedImage (width, height,
      BufferedImage.TYPE_INT_ARGB);
// fill image
    // Save
    File outputFile = new File("image.png");
    ImageIO.write(output, "PNG", outputFile);
0 Comments  (click to add your comment)
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

About | Sitemap | Contact
×
We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.