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?
Latest posts by Mark Stephens (see all)
- NetBeans Day UK announced for Tuesday 25th April 2017 - February 1, 2017
- The 2017 Guide to PDF Files – Creation II - January 19, 2017
- The 2017 Guide to to PDF Files – Creation I - January 17, 2017
- 7 ways we might change the way we develop software in 2017 - January 6, 2017
- IDRsolutions will move to Java8 in April 2017 - November 8, 2016