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 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. Our PNGEncoder is at least twice as fast as ImageIO, and it offers much better support for Tiff, JPEG and JPEG2000. It also supports additional image formats such as DICOM, PSD, SGI and WEBP. Moving to our own image library will allow us to:
- Substantially improve speed and memory usage in our commercial products
- Easily fix issues in image out
- Add new features (like being able to easily down-sample PNG to indexed PNG
We have made this available as a separate download which is free to download and use (you will need to pay to ship it with any products).
So what is your experience of image support in Java. Are you still using JAI and ImageIO or implementing your own solution?