将图像的颜色值存至一个二维数组,以jpg图像格式为例import com.sun.image.codec.jpeg.*;//为处理jpgint a[][];//声明一个二维数组的引用FileInputStream n=new FileInputStream("image.jpg");//image.jpg为图像
JPEGImageDecoder decoder=JPEGCodec.createJPEGDecoder(in);
Source_image=decoder.decodeAsBufferedImage();int width=Source_image.getWidth();
int height=Source_image.getHeight();
a=int [width][height];for(int i=0;i<width-1;i++)
{
    fo(int j=0;j<height-1;j++)
    {
        a[height][width]=Source_image.getRGB(width,height);
     }
}a[][]最终得到颜色的二维数组.