<p>I have two BufferedImages I loaded in from pngs. The first contains an image, the second an alpha mask for the image.</p>

<p>I want to create a combined image from the two, by applying the alpha mask. My google-fu fails me.</p>

<p>I know how to load/save the images, I just need the bit where I go from two BufferedImages to one BufferedImage with the right alpha channel.</p>

Actually, I've figured it out. This is probably not a
fast
way of doing it, but it works:
```
```
for (int y = 0; y < image.getHeight(); y++) {
    for (int x = 0; x < image.getWidth(); x++) {
        Color c = new Color(image.getRGB(x, y));
        Color maskC = new Color(mask.getRGB(x, y));
        Color maskedColor = new Color(c.getRed(), c.getGreen(), c.getBlue(),
            maskC.getRed());
        resultImg.setRGB(x, y, maskedColor.getRGB());
    }
}
```
```