I have been playing with some of the imaging functionality in Java, trying to superimpose one image over another. Like so:
BufferedImage background = javax.imageio.ImageIO.read(
new ByteArrayInputStream(getDataFromUrl(
"http://www.google.com/intl/en_ALL/images/logo.gif"
))
);
BufferedImage foreground = javax.imageio.ImageIO.read(
new ByteArrayInputStream(getDataFromUrl(
"http://upload.wikimedia.org/wikipedia/commons/e/e2/Sunflower_as_gif_small.gif"
))
);
WritableRaster backgroundRaster = background.getRaster();
Raster foregroundRaster = foreground.getRaster();
backgroundRaster.setRect(foregroundRaster);
Basically, I was attempting to superimpose this: http://upload.wikimedia.org/wikipedia/commons/e/e2/Sunflower%5Fas%5Fgif%5Fsmall.gif
on this: http://www.google.com/intl/en%5FALL/images/logo.gif
The product appears as: http://imgur.com/xnpfp.png
From the examples I have seen, this seems to be the appropriate method. Am I missing a step? Is there a better way to handle this? Thank you for your responses.