标签:stat eth height get ++ 而在 imageio color getwidth
public static int[][] getImageGRB(String filePath) { int[][] result=null; File file = new File(filePath); if (!file.exists()) { return result; } try { BufferedImage bufImg = ImageIO.read(file); int width = bufImg.getWidth(); int height = bufImg.getHeight(); result=new int[width][height]; for(int i=0;i<height;i++){ for(int j=0;j<width;j++){ result[i][j]=bufImg.getRGB(j,i)&0xFFFFFF; } } } catch (Exception e) { } return result; }
备注:因为使用getRGB(i,j)获取的该点的颜色值是ARGB,而在实际的应用中使用的的是RGB,所以需要将ARGB转化为RGB,即bufImg.getRGB(w,h)
标签:stat eth height get ++ 而在 imageio color getwidth
原文地址:http://www.cnblogs.com/HDK2016/p/7833841.html