Search This Blog

Java JAI ImageIO: read from tiff and write to bmp

package examples;

import java.awt.image.BufferedImage;
import java.io.File;

import javax.imageio.ImageIO;

public class ImageUtil {
 
 public static void main(String[] args) throws Throwable {
  File inputFile = new File("/tmp/1.tif");
  File outputFile = new File("/tmp/1.bmp");
  BufferedImage image = ImageIO.read(inputFile);
  BufferedImage convertedImage = new BufferedImage(image.getWidth(), 
      image.getHeight(), BufferedImage.TYPE_INT_RGB);
  convertedImage.createGraphics().drawRenderedImage(image, null);
  ImageIO.write(convertedImage, "bmp", outputFile);
 }

}

Note

No comments:

Post a Comment