RGBの8ビットグレーの配列に変換するには:あなたはRGB配列がBufferedImageに変換することができた後
int[] greyArraySource = ...;
int[] rgbArray = new int[greyArraySource.length];
for(int i=0; i<greyArraySource.length; i++) {
int color = (int)aImageData[i];
if(color < 0)
{
color = 256 + color;
}
rgbArray[i] = Color.rgb(color,color,color);
}
を:
// Initialize BufferedImage
int width = ...;
int height = ...;
BufferedImage bufferedImage = new BufferedImage(width, height,
BufferedImage.TYPE_INT_RGB);
// Set RGB array to the BufferedImage
BufferedImage.setRGB(0,0,BufferedImage.getWidth(),
BufferedImage.getHeight(),rgbArray, 0, BufferedImage.getWidth());
JPGにBuffuredImageを変換します
File outputfile = new File("image.jpg");
ImageIO.write(bufferedImage, "jpg", outputfile);
あなたの画像は4ビットで表示されるようです変換を変更する必要があります。配列の値を投稿すると、おそらく私はチェックできます。
@Geekarはあなたが正常に画像を得る持っていますか? – LaurentY