java中如何读取图片的像素

如题所述

第1个回答  2013-06-01
BufferedImage img = ImageIO.read(new File(filename));
Raster ra = img.getData();
Rectangle rect = ra.getBounds();
// int nWidth = ra.getMinX();
int nImageDate[] = new int[rect.height*rect.width];
int nTemp[] = new int[400*400];
nImageDate = ra.getPixels(0,0,rect.width, rect.height,nTemp);本回答被网友采纳
相似回答