Link
Skip to main content

Java TIFF Writer

The JDeli Java image library includes a TIFF Writer to write TIFF files in Java. The TIFF Encoder is written in 100% Java and provides TIFF support with no dependencies.

Key information:

  • 100% Java solution. No dlls or dependencies on native code
  • Compression: Uncompressed, Deflate, JPEG, LZW
  • Access to xmp metadata
  • Single, Multi-file

Quick start or to replace in existing code using ImageIO:

JDeli.write(myBufferedImage, "tiff", outputStreamOrFile);

or

byte[] outputData = JDeli.write(myBufferedImage, "tiff");

New method for quick and simple usage

JDeli.write(myBufferedImage, OutputFormat.TIFF, outputStreamOrFile)

OutputFormat allows setting of any supported Image Format

For complete control of output:

final TiffEncoderOptions options = new TiffEncoderOptions();

//set any options in options instance - examples below
options.setCompressionFormat(TiffCompressionFormat.DEFLATE);
options.setXmpMetaData("xmp metadata");

//set Image resolution
tiffEncoderOptions.setResolutionUnit(TiffResolutionUnit.INCH);
tiffEncoderOptions.setXResolution(144);
tiffEncoderOptions.setYResolution(144);

//write out
JDeli.write(myBufferedImage, options, outputStreamOrFile);

TiffEncoderOptions allows setting of specific options.

Various image processing operations can be conducted on the image, detailed documentation can be found here.

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.

Mode: Throughput Count: 25 Units: ops/s

Benchmark Score Error
Apache 4.140 ± 0.070
ImageIO_Deflate 4.533 ± 0.054
ImageIO_JPEG 7.788 ± 0.084
ImageIO_LZW 4.265 ± 0.043
ImageIO_uncompressed 9.213 ± 0.029
JDeli_better_comp 5.484 ± 0.007
JDeli_better_speed 13.116 ± 0.026
JDeli_deflate 6.361 ± 0.017
JDeli_jpeg 25.160 ± 1.732
JDeli_LZW 9.473 ± 0.027
JDeli_uncompressed 99.850 ± 3.051

Number of files: 166

Benchmark Size unreadable output AVG SSIM score AVG Similarity
Apache 1.83MB 1 1.0 Identical or virtually identical
ImageIO_deflate 2.78MB 1 1.0 Identical or virtually identical
ImageIO_jpeg 0.87MB 114 0.9964492586342384 Identical or virtually identical
ImageIO_lzw 3.89MB 1 1.0 Identical or virtually identical
ImageIO_uncompressed 4.84MB 1 1.0 Identical or virtually identical
JDeli_better_comp 2.66MB 1 1.0 Identical or virtually identical
JDeli_better_speed 2.78MB 1 1.0 Identical or virtually identical
JDeli_deflate 2.66MB 1 1.0 Identical or virtually identical
JDeli_jpeg 0.26MB 1 0.8720826599375827 Similar (noticeable but minor differences)
JDeli_lzw 3.88MB 1 1.0 Identical or virtually identical
JDeli_uncompressed 4.84MB 1 1.0 Identical or virtually identical

Tested on 2021 14inch M1 MacBook Pro using JDK 18.0.1.1


Why JDeli?

  • Support image formats such as AVIF, HEIC and JPEG XL that are not supported in Java.
  • Process images up to 3x faster than ImageIO and alternative Java image libraries.
  • Prevent JVM crashes caused by native code in other image libraries such as ImageIO.
  • Handle JPEG, PNG, TIFF image file formats fully in Java.
  • Keep your Image files secure as JDeli makes no calls to any external system or third party library.

Learn more about JDeli

Start Your Free Trial