Java抓取图像像素到int数组

2014-10-27 08:30:08 · 作者: · 浏览: 82

  int w=im.getWidth(this);


  int h=im.getHeight(this);


  int[] pixels=new int[w*h];


  public int[] Image2intAarry(Image im){


  try{


  PixelGrabber pg=new PixelGrabber(im,0,0,w,h,pixels,0,w);


  pg.grabPixels();


  }catch(InterruptedException e){


  e.printStackTrace();


  }


  return pixels;


  }


  编辑特别推荐: