Monday, July 01, 2013

JAI and Image Processing in Java


I have minimal experience with Image Processing and when I'm talking about it I mean:
  • read/write different image formats (jpg, png, tiff, ice, etc.)
  • flip, rotate image
  • crop and clip image by defined path
  • convert image's color (e.g. RGB to gray scale)
  • reduce image size
  • find edges
  • image histograms and color counting
  • different operations (e.g. AND, OR and XOR)
  • read image meta info
Of course, I don't want to waist time implementing all these by myself, because it's basic operation in Image Processing (IP) domain. And I believe that all these tasks are pretty much trivial for any engineer who's working in Image Processing.

As usual I have strict restriction regarding the licence of selected library (which can be used in any commecrial product).

So, I've started googling. Here is the initial (and filtered) results:
This library was developed by SUN. Unfortunately, it's not supported anymore. But, it's very powerful and has nice facilities.
JAI is available for Windows, Linux, Mac OS X, and Solaris, and takes advantage of native acceleration when available. However, you can use the JAI libraries on any platform if you add the following JAR files to your classpath: 
JAI Tutorials, Guides, Sources
Also, you should check the JAI sources. Here is the master JAI project on with several sub-projects:
JAI Licenses. It's very tricky question. Here is the quote from
As far as I know, the libraries from JAI and JAI Image I/O Tools can be
bundled with a commercial product or can be downloaded on the fly using
the Java Web Start technology.

You might like to take a look at how people have been using JAI and JAI
Image I/O Tools:
As for commercial license, you might like to read the LICENSE and README
files for the binaries:

and the licenses for the source code (if you make your own build of JAI):
I'm not sure whether you can include this library into your commercial project. You should answer on this question by yourself. 

It's a very popular application/library in Java community. I've considered it also. This library has very big community. Also, it has many plugins. Documentation (User Guide, tutorials, wiki, FAQ, etc) are located in one place, easy to find. But, I wouldn't use ImageJ in case of simple image processing operations. 

Other Libraries
I've reviewed the mentioned above other libraries and I must say they have nice features also. But they are too heavy (as well as ImageJ) for the tasks I've been trying to accomplish.

  • JAI isn't maintained by Oracle. You should be careful when including it in commercial product
  • ImageJ, Commons Imaging, JAITools , and Marvin are providing huge set of IP facilities, but it might be redundant in your case.
  • Plain Java core image library can solve almost all your needs, except TIFF/PDF file  processing.
  • TIFF/PDF file processing should be done by 3d-party libraries (e.g. iText, JAI).