0
私はBufferedImageにフィードしてjpegを生成するために必要なrgb値の1次元整数配列を持っています。私は、これはかなり単純に見えるBufferedImage setRGB:画像が四分の一のサイズに縮小されました
int numRows = 128;
int numCols = 128;
int inputIndex = 0;
BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
for(int row = 0; row < numRows; row++){
for(int col = 0; col < numCols; col ++){
int rgb = rgbvals[inputIndex++];
rgb = (rgb << 8) + rgbvals[inputIndex++];
rgb = (rgb << 8) + rgbvals[inputIndex++];
image.setRGB(col,row, rgb);
}
}
File outputFile = new File("output.jpg");
ImageIO.write(image, "JPEG", outputFile);
(私はバッファリングされたイメージに一度の配列を渡してみました、トラブルに走ったとだけでなく、それは別の問題だ)128個の* 128ピクセルを持って、私はSetRGBはを使用してステップオーバーしていました私のイメージは次のようになります。
128*128 picture of an eye, except it takes up 1/4 the space it needs and the rest of the image is black
細かい部分を見落としているような気がします。感謝します。ありがとう!