This repository contains ImageIO plugins that wrap the most common native libraries for various image formats with JNR-FFI. This has the advantage of being generally the fastest available option on the JVM, with the drawback that you need to make sure that the corresponding native libraries are installed on the target system. However, thanks to JNR-FFI, no compiler is neccessary, the plugins will directly use the installed native libraries and you can install them directly from Maven Central.
Please note that the plugins need at least Java 8 and Ubuntu 16.04.
Module | Format | Backing native library | Required version | JavaDoc |
---|---|---|---|---|
imageio-openjpeg | JPEG2000 | OpenJPEG | >= 2.0 (>=2.3 recommended for performance) | |
imageio-turbojpeg | JPEG | TurboJPEG | >= 1.4 |
To use the ImageIO plugins, include them in your dependencies:
<dependency>
<groupId>de.digitalcollections.imageio</groupId>
<artifactId>imageio-turbojpeg</artifactId>
<version>0.3.0</version>
</dependency>
<dependency>
<groupId>de.digitalcollections.imageio</groupId>
<artifactId>imageio-openjpeg</artifactId>
<version>0.3.0</version>
</dependency>
Before using them, make sure that you have all the required native libraries installed, e.g. on Debian-based systems:
$ sudo apt install libturbojpeg1 libopenjp2-7
- Decoding:
- Tiled decoding
- Decoding of arbitrary regions
- Decoding of only a specific resolution
- Encoding:
- Lossless compression
- Lossy compression with user-defined quality
- Tiled encoding
- Encoding of multiple resolutions
- Decoding:
- Decoding of arbitrary regions
- Decoding of only a specific resolution
- Rotate image before decoding
- Encoding:
- Lossy compression with user-defined quality
JNR-FFI itself is compatible with a large number of architectures, so you merely need to make sure that the backing native libraries are compatible with your architecture. Both OpenJPEG and TurboJPEG are available for the majority of commonly used platforms.
- Q: I get a
Failed to read JPEG info.
IllegalArgumentException
when using the TwelveMonkeys ImageIO libraries in version 3.4.1 when reading a TIFF with JPEG compressed data. A: Stick to Twelvemonkeys version 3.3.2 for now. We're currently investigating the issue.