次のような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値で画像を初期化する適切な方法は何ですか?
編集:私の画像は次のようになります
ありがとう、ジェフ