Java: Convert image to png format

  • Make sure you have JAI & ImageIO plugins installed. Recommend to use standlone/independent jai-imageio-core from github.
  • The example code:
    • import java.awt.image.BufferedImage;
      import javax.imageio.ImageIO;
      public static void main(String[] args) {
        // read a tiff image
        BufferedImage bufferedImage = File("c:/tmp/1.tif"));
        // write back to another file in png format
        ImageIO.write(bufferedImage, "png", new File("c:/tmp/1.png"));

No comments:

Post a Comment