Note that there are some explanatory texts on larger screens.

plurals
  1. POJava: using WritableRaster.setRect to superimpose an image?
    primarykey
    data
    text
    <p>I have been playing with some of the imaging functionality in Java, trying to superimpose one image over another. Like so:</p> <pre><code>BufferedImage background = javax.imageio.ImageIO.read( new ByteArrayInputStream(getDataFromUrl( "https://www.google.com/intl/en_ALL/images/logo.gif" )) ); BufferedImage foreground = javax.imageio.ImageIO.read( new ByteArrayInputStream(getDataFromUrl( "https://upload.wikimedia.org/wikipedia/commons/e/e2/Sunflower_as_gif_small.gif" )) ); WritableRaster backgroundRaster = background.getRaster(); Raster foregroundRaster = foreground.getRaster(); backgroundRaster.setRect(foregroundRaster); </code></pre> <p>Basically, I was attempting to superimpose this: <a href="https://upload.wikimedia.org/wikipedia/commons/e/e2/Sunflower_as_gif_small.gif" rel="nofollow noreferrer">https://upload.wikimedia.org/wikipedia/commons/e/e2/Sunflower_as_gif_small.gif</a><br> <img src="https://upload.wikimedia.org/wikipedia/commons/e/e2/Sunflower_as_gif_small.gif" alt="flower"> <br> on this: <a href="https://www.google.com/intl/en_ALL/images/logo.gif" rel="nofollow noreferrer">https://www.google.com/intl/en_ALL/images/logo.gif</a><br> <img src="https://www.google.com/intl/en_ALL/images/logo.gif" alt="alt text"> <br><br></p> <p>The product appears as: <a href="https://imgur.com/xnpfp.png" rel="nofollow noreferrer">http://imgur.com/xnpfp.png</a><br> <img src="https://imgur.com/xnpfp.png" alt="crappy image"> <br><br></p> <p>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.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload