Steffen Krause wrote:
> I load an image from a BMP file using JAI 1.1.2. So far so good, now I
> have it as BufferedImage. Next I want to draw it on top of another image
> but with it's background beeing transparent.
Then that part of the image which should be transparent needs to have
its alpha component set to transparent (0.0). Or (an old trick), you
reverse the upper and lower image: You set all of the underlying image
to transparent, and actually paint the underlying image over the top image.
> Just to let you know
> exactly what I mean, the background image is a photo and the other pic
> is a blue filled circle with a magenta background.
Magenta? Well, what company could that be?

)
> Now the blue circle
> should be drawn over the photo but of course without the magenta
> showing. Can anybody help me??
Once you have the alpha of the background set correctly, create an
AlphaComposite, e.g. with SRC_OVER or DST_OVER (depends which image you
paint over which). Get the Graphics2D of one of the BufferedImages, and
set the composite on it. Then paint the other image over the first one,
using the Graphics2D object.
/Thomas