Skip to content

ImageIO reader/writer plugins wrapping native libraries: OpenJP2 and TurboJPEG

License

Notifications You must be signed in to change notification settings

dbmdz/imageio-jnr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

imageio-jnr

Javadocs License GitHub release Maven Central

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 11 and Ubuntu 20.04.

Currently available plugins

Module Format Backing native library Required version JavaDoc
imageio-openjpeg JPEG2000 OpenJPEG >= 2.0 (>=2.3 recommended for performance) Javadocs
imageio-turbojpeg JPEG TurboJPEG >= 1.4 Javadocs

Installation

To use the ImageIO plugins, include them in your dependencies:

<dependency>
  <groupId>de.digitalcollections.imageio</groupId>
  <artifactId>imageio-turbojpeg</artifactId>
  <version>0.6.8</version>
</dependency>

<dependency>
  <groupId>de.digitalcollections.imageio</groupId>
  <artifactId>imageio-openjpeg</artifactId>
  <version>0.6.8</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 libturbojpeg0 libopenjp2-7

Supported features

imageio-openjpeg

  • 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

imageio-turbojpeg

  • Decoding:
    • Decoding of arbitrary regions
    • Decoding of only a specific resolution
    • Rotate image before decoding
  • Encoding:
    • Lossy compression with user-defined quality

Platform-(In)Dependence

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.