Mark Stephens Mark has been working with Java and PDF since 1999 and is a big NetBeans fan. He enjoys speaking at conferences. He has an MA in Medieval History and a passion for reading.

Are you a Java Developer working with Image files?

Read and write images in Java with JDeli

Why we have abandoned ImageIO and JAI for Image support in our commercial Java code

42 sec read

JDeli

jpeg-icon

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.



Find out how to read and write images files in Java with JDeli:

Read: BufferedImage image = JDeli.read(streamOrFile);

Write: JDeli.write(myBufferedImage, OutputFormat.HEIC, outputStreamOrFile)

Learn more >>

Mark Stephens Mark has been working with Java and PDF since 1999 and is a big NetBeans fan. He enjoys speaking at conferences. He has an MA in Medieval History and a passion for reading.

Should you travel by plane or train?

Why travel to Switzerland by train This year, my daughter set me the challenge to take the train rather than fly when I next...
Mark Stephens
1 min read

13 Replies to “Why we have abandoned ImageIO and JAI for Image…”

      1. 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.

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

        1. 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.

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

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

    1. 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.

Comments are closed.