At IDRsolutions, we are now using our own Java Image Library (JDeli) as a replacement for ImageIO and JAI. We had previously been using ImageIO and JAI to handle image data and write out BufferedImages as PNGs, JPEGs or Tiff and for decoding some image data inside PDF files since we started writing our Java PDF library in 1999.
However, this has become an increasingly frustrating and unsatisfactory solution for us 🙁
JAI has long been abandoned by Oracle (we have actually put out several tips and patches for JAI JPEG2000 bugs on our blog) which offers no alternative way to load JPEG2000 files in Java. The JPEG2000 implementation was never completed and is slow, memory-intensive, and does not handle lots of JPEG2000 files.
ImageIO has seen little improvement in recent Java releases, despite being the only way to load and save Images in Java. Indeed is it still needed in the new JavaFX code to load and save images. It also represents a big black box in our PDF to Image solution which we have no control over. So we have been busy writing our own Java image library (JDeli), and now use this instead of JAI or ImageIO.
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
Where can we find your new library?
It is bundled into our applications. No plans for separate release at present.
May I just suggest — since you enjoyed the community’s efforts for over a decade — that you contribute that image library back to the community? Seems only fair.
We contributed a JBIG2 decoder library for Java under a BSD license (which most of our competitors use) and submitted numerous fixes for JAI. (and we are currently organising a big Java community event in UK in May). So we are active contributors to the community….
There is an interesting Open source library for PNG from Google if you are looking for an OS solution (https://code.google.com/p/pngj/).
Might I suggest you sell it, offer licenses?
At the moment we are just trying to fill a need in our code and thought it would make an interesting item for a blog article for other users wrestling with the issue of image support in Java. All options are on the table in future.
It is now available to use and download. You will only need to pay if you want to distribute it
I am using twelvemonkeys ImageIO. The result is acceptance. Why you don’t release ur library. I wanna try yours.
You can now try and use it yourself (https://www.idrsolutions.com/jdeli/)
(I’m the author of the TwelveMonkeys ImageIO library that @Nguyen mentions. I’m just about to release the 3.1 version of my library, with a greatly improved and more robust JPEG reader, along with other new features such as baseline TIFF write support etc., in case you were interested).
Having a BSD-licensed pure Java JPEG (especially if it supported arithmetic coding, lossless and other non-baseline stuff) or JPEG2000 ImageReader would be a great thing! If you would contribute it to the project, you could have all my other format support for free (ok, you can have it anyway, it’s BSD licensed, I’m just trying to sweeten the deal a little.. 😉 )!
Anyway, keep up the good work!
.k
Hi Harald,
Great to hear about the new release and we will try to help promote it. The Java world needs alternatives to ImageIO! At the moment we are just trying to fix an issue which is a major headache for our customers. Once we have it fully working we will consider future plans.
Thanks.!
Just to let you know, the new version is now out! 🙂
Regards,
—
Harald K
We look forward to trying it….