What is JPEG2000?
JPEG2000 is an important image file format which offers significant benefits over JPEG. For our specific usage it does generate significantly smaller file sizes for images which is critical for many of our customers.
What solutions already exist?
There are already a couple of JPEG libraries available for Java. The most well-known is ImageIO which can read and write JPEG images. There is also an Open-source library called jj2000. Both of these have good basic support for RGB images, but work less well on other Colorspaces (CMYK, YCCK, etc).
What is wrong with the current solutions?
However, they are not complete implementations, for example lacking features such as ROI (Region Of Interest). They need a lot of memory and have a number of irritating bugs. We have written up some of these under a previous blog post ‘Fixing bugs in Java JPEG2000‘.
When writing JPedal (our Java PDF library), these are critical concerns. PDF data is often in non-RGB colorspace and the data is from many different tools.
We also felt that starting afresh with Java 8 would make it easier to write and develop a compact library. Indeed, the JDeli JPEG2000 Decoder is generally twice the speed of JAI and uses significantly less memory than jj2000.
So if you are looking for a free JPEG2000 library for Java and working with just RGB images, we can recommend ImageIO and jj2000 as excellent tools (at least as a starting point). If you need a heavy duty commercial JPEG2000 Decoder/Encoder we hope you will evaluate JDeli.
Read and write images in Java with one line of code
Read an Image with
BufferedImage image = JDeli.read(streamOrFile);
and write an Image with
JDeli.write(myBufferedImage, OutputFormat.HEIC, outputStreamOrFile)