Proper JAI Practices

Posted on 2006-05-26
Medium Priority
Last Modified: 2008-01-09
Hello All,

I have an imaging program that uses JAI extensivly and I was wondering if there are any "proper" coding techniques when using JAI that handle memory management, running time etc...

For example.

I am loading, adjusting brigheness, contrast, adding border, and saving an image. How I am doing this currently is I have a static class that has methods such as jaiLoad, jaiBrightness, jaiContrast, jaiBorder etc. and I am just running them 1 after another.

The problem comes when I start to perform many operations, I start to get out of memory errors, long execution time etc.

Is there a way to combine multiple JAI operations into 1 parameter block?
Is there any way to minimize the amount of memory a RenderedOp takes up?
Should I be using BufferedImage's or RenderedOp's?

I have searched and searched the web for good JAI resources but there seems to be none. I think when I figure out all of this I might dedicate a website to JAI.

Resources, tips, code snipplets would all help!



P.S. Please no suggestions about setting the JVM memory (eg. -Xmx, -Xms)
Question by:maclema
  • 2

Accepted Solution

fffej78 earned 1400 total points
ID: 16774544
The resources on dev.java.net are good see https://jai.dev.java.net/

There is a book, but I have no idea how good it is "Building Imaging Applications with Java(TM) Technology: Using AWT Imaging, Java 2D(TM), and Java(TM) Advanced Imaging (JAI)"
The FAQ is here ( http://java.sun.com/products/java-media/jai/forDevelopers/jaifaq.html )

Looking at samples is the best way to do things "properly".

Best place to ask for help is the mailing list on JAI itself:


Image processing does take a lot of time and memory in general though :)
LVL 14

Assisted Solution

hoomanv earned 600 total points
ID: 16775114

Author Comment

ID: 16784953
I am going to leave this question open for a while longer in hope of more resources...

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses
Course of the Month16 days, 3 hours left to enroll

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question