开发者

Merge two single channel BufferedImage objects

开发者 https://www.devze.com 2023-03-06 17:18 出处:网络
I have code that combines two BufferedImage objects, each one representing a separate color channel (red and blue). Currently I am doing:

I have code that combines two BufferedImage objects, each one representing a separate color channel (red and blue). Currently I am doing:

int p, q, g, b;
        for (int x = 0; x < width; ++x) {
            for (int y = 0; y < height; ++y) {
                p = img0.getRGB(x, y) & 0xff00;
                q = img1开发者_如何学Python.getRGB(x, y) & 0xff;
                fused.setRGB(x, y, p | q);
            }
        }

However, this is rather slow for a 2000x2000 image. Is there a faster way to do this via the Java2D or JAI API's? I've read up on the AlphaComposite class, but that seems to combine images based on transparency, rather than actually merge channels.

Any pointers would be appreciated.

0

精彩评论

暂无评论...
验证码 换一张
取 消