我有一个 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 值初始化图像的正确方法是什么?
编辑:这是我的图像的样子
谢谢,杰夫