When is it recommended to use Java Advanced Imaging (JAI) instead of the Java 2D API?

Curtis Hatter

Basically it depends on the requirements of the program.

If I were able to do the required graphics with Java 2D, then I did so. But if I needed more advanced graphical capabilities then I would import the JAI package and convert my buffered image to a planar image and do what I needed.

For image loading I actually use Java Imaging I/O (since it will be part of 1.4 release) unless I need to read in images other then gif, jpg, or png.

Which brings me to another point.. if you wish to use images other than gif, jpg, or png, your only options (that I know of offered by SUN) are JIMI, and JAI. JAI offers a lot more then JIMI but does seem to use up a lot more memory and processing time. JIMI also is supposed to be jdk 1.1 compliant which could be a plus if you have to use a older jdk.

JAI also provides more information on the images then Java2D does, so if you need that info once again you might be better off with JAI.