views:

166

answers:

0

I'm working on a project which deals with image processing and I don't have a great deal of know-how about image processing in JAVA. I've recently started using "Java Advanced Imaging" for manipulating images.

I'm facing problem in applying "layer mask" to images.

I have to use a "layer mask" in my application much like the layer masks that are available in Photoshop. Here is an example of it: http://www.photoshopcafe.com/tutorials/blend/blend.html

Basically I have a bottom layer which is a uniform color (Eg: Blue) and a top layer which is also a uniform color (Eg: Red) to which I need to apply a Black & White mask.....

What I need to do: The layer on the top is a uniform colored canvas whose color is the color that replaces the white (of the B&W mask) The layer on the bottom is a uniform colored canvas whose color is the color that replaces the black (of the B&W mask) The mask is the B&W image and is applied to the layer on the top.

I've checked various examples of JAI like "Composite", "Add", "Subtract", "Layers" etc but none of them seem to deal with a layer mask. The best I found was adding an alpha (black & white mask) to one colored image.

Any help would be appreciated.

Thanks, Ravi