Link

Java TIFF Reader

JDeli includes a TIFF Reader to read TIFF images into Java. The TIFF Decoder is written in 100% Java with no dependencies.

Key information:

  • 100% Java solution. No dlls or dependencies on native code
  • Compression: CCITT 3,4, Pack bit, LZW, Adobe Deflate, JPEG technote2 and Deflate
  • Colorspace: bilevel, grayscale, rgb, argb, cmyk, acmyk, ycbcr
  • Bits Per Sample: 1 to 32
  • Byte Ordering: Little and Big Endian
  • Other: Single, Multi-file, Tiling, Planar (Chunky, Separated), Predictor, 16/32-bit floating samples

Quick start:

JDeli can automatically detect the file type and will use the TIFF File Reader

BufferedImage image = JDeli.read(tiffImageFile);

or

TiffDecoder decoder = new TiffDecoder();
BufferedImage image = decoder.read(tiffData);

See the full Javadoc.

Performance comparisons:

These figures were generated using jmh (as documented on our blog) with a standard set of images (also documented). They should be easy to replicate if you wish to validate, the code is on GitHub.

The higher the number, the better.

Benchmark Mode Cnt Score Error Units
Apache throughput 25 6.601 ± 0.119 ops/s
ImageIO throughput 25 7.976 ± 0.140 ops/s
JDeli throughput 25 11.298 ± 0.363 ops/s

Tested on 2020 13inch M1 MacBook Pro using JDK 18.0.1.1

Read Multi Image tiff files

This needs the TiffDecoder class

File file = new File("/path/to/file");
TiffDecoder dec = new TiffDecoder();
int totalImages = dec.getImageCount(file);
for (int i = 0; i <= totalImages; i++) {
   BufferedImage image = dec.read(i , file); // i is the image number
   // Insert BufferedImage handling code here
}

Start Your Free Trial


Customer Downloads