Why we are abandoning ImageIO and JAI for Image support in our commercial Java code

jpeg-iconAt 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:-

  1. Substantially improve speed and memory usage in our commercial products
  2. Easily fix issues in image out
  3. 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?

If you’re a first-time reader, or simply want to be notified when we post new articles and updates, you can keep up to date by social media (Twitter, Facebook and Google+) or the Blog RSS.

Related Posts:

The following two tabs change content below.

Mark Stephens

System Architect and Lead Developer at IDRSolutions
Mark Stephens has been working with Java and PDF since 1999 and has diversified into HTML5, SVG and JavaFX. He also enjoys speaking at conferences and has been a Speaker at user groups, Business of Software, Seybold and JavaOne conferences. He has a very dry sense of humor and an MA in Medieval History for which he has not yet found a practical use.
Markee174

About Mark Stephens

Mark Stephens has been working with Java and PDF since 1999 and has diversified into HTML5, SVG and JavaFX. He also enjoys speaking at conferences and has been a Speaker at user groups, Business of Software, Seybold and JavaOne conferences. He has a very dry sense of humor and an MA in Medieval History for which he has not yet found a practical use.

13 thoughts on “Why we are abandoning ImageIO and JAI for Image support in our commercial Java code

  1. pron

    Where can we find your new library?

    • It is bundled into our applications. No plans for separate release at present.

      • pron

        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/).

      • Art Solano

        Might I suggest you sell it, offer licenses?

  2. Nguyen

    I am using twelvemonkeys ImageIO. The result is acceptance. Why you don’t release ur library. I wanna try yours.

  3. (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

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>