At IDRsolutions, we have 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 rewriting our own implementations and the next major commercial release of JPedal will no longer make use of JAI or ImageIO. We have already added our own PNGEncoder (which is at least twice as fast as ImageIO), and we are currently debugging our JPEG2000/JPEG support. Moving now to our own encoder/decoder 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?