Can't read and write a TIFF image file using Java ImageIO standard library

Gle picture Gle · Dec 23, 2009 · Viewed 57.2k times · Source

I don't know what to do with TIFF images, but I can't read or write any of them using straight Java standard ImageIO library. Any thoughts?

Thanks.

Answer

haraldK picture haraldK · May 29, 2013

If you don't like or can't use JAI for any reason I have written a TIFF ImageReader plugin for ImageIO, available on GitHub. It is pure Java and does not need any native installs, and comes with a very friendly open source license (BSD).

It supports any baseline TIFF option, along with a lot of standard extensions. From version 3.1 the TIFF plugin also has write support.

With the proper JARs in your class path, usage can be as simple as:

BufferedImage image = ImageIO.read(inputTIFF);
// ...modify image (compose, resize, sharpen, etc)...
ImageIO.write(image, "TIFF", outputTIFF);