What is JPEG 2000?
JPEG 2000 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 JPEG 2000‘.
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 JPEG 2000 Decoder is generally twice the speed of JAI and uses significantly less memory than jj2000.
So if you are looking for a free JPEG 2000 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 JPEG 2000 Decoder/Encoder we hope you will evaluate JDeli.
Are you a Java Developer working with Image files?
// Read an image
BufferedImage bufferedImage = JDeli.read(dicomImageFile);
// Read an image
BufferedImage bufferedImage = JDeli.read(heicImageFile);
// Write an image
JDeli.write(bufferedImage, "heic", outputStreamOrFile);
// Read an image
BufferedImage bufferedImage = JDeli.read(jpegImageFile);
// Write an image
JDeli.write(bufferedImage, "jpeg", outputStreamOrFile);
// Read an image
BufferedImage bufferedImage = JDeli.read(jpeg2000ImageFile);
// Write an image
JDeli.write(bufferedImage, "jpx", outputStreamOrFile);
// Write an image
JDeli.write(bufferedImage, "pdf", outputStreamOrFile);
// Read an image
BufferedImage bufferedImage = JDeli.read(pngImageFile);
// Write an image
JDeli.write(bufferedImage, "png", outputStreamOrFile);
// Read an image
BufferedImage bufferedImage = JDeli.read(tiffImageFile);
// Write an image
JDeli.write(bufferedImage, "tiff", outputStreamOrFile);
// Read an image
BufferedImage bufferedImage = JDeli.read(webpImageFile);
// Write an image
JDeli.write(bufferedImage, "webp", outputStreamOrFile);
Why do developers choose JDeli over free alternatives?
- Works with newer image formats such as AVIF, HEIC, JPEG XL, WEBP
- Better support than alternatives for JPEG, PNG, TIFF.
- Prevent JVM crashes caused by native code in other image libraries
- Better performance than other popular Java image libraries