我想从2D数组创建图像.我使用Buffer
Image概念来构造
Image.but原始图像和构造图像之间存在差异由下面的图像显示
我使用以下代码
import java.awt.image.BufferedImage;
import java.io.File;
import javax.imageio.ImageIO;
/ **
*
* @author pratibha
* /
public class ConstructImage{
int[][] PixelArray;
public ConstructImage(){
try{
BufferedImage bufferimage=ImageIO.read(new File("D:/q.jpg"));
int height=bufferimage.getHeight();
int width=bufferimage.getWidth();
PixelArray=new int[width][height];
for(int i=0;i
for(int j=0;j
PixelArray[i][j]=bufferimage.getRGB(i, j);
}
}
///create Image from this PixelArray
BufferedImage bufferImage2=new BufferedImage(width, height,BufferedImage.TYPE_INT_RGB);
for(int y=0;y
<