我有一个整数RGB像素数组,大致如下:
pixels[0] = <rgb-value of pixel(0,0)>
pixels[1] = <rgb-value of pixel(1,0)>
pixels[2] = <rgb-value of pixel(2,0)>
pixels[3] = <rgb-value of pixel(0,1)>
...etc...
我正在尝试从中创建一个BufferedImage。我尝试了以下方法:
BufferedImage img = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
img.getRaster().setPixels(0, 0, width, height, pixels);
但是生成的图像存在颜色带问题。图像不清晰,且有对角线和水平线穿过。
如何使用rgb值正确初始化图像?
编辑:
这是我的图像样子
谢谢, Jeff