Java - get pixel array from image

后端 未结 7 1062
面向向阳花
面向向阳花 2020-11-22 03:52

I\'m looking for the fastest way to get pixel data (int the form int[][]) from a BufferedImage. My goal is to be able to address pixel (x, y) from

7条回答
  •  名媛妹妹
    2020-11-22 04:42

    This worked for me:

    BufferedImage bufImgs = ImageIO.read(new File("c:\\adi.bmp"));    
    double[][] data = new double[][];
    bufImgs.getData().getPixels(0,0,bufImgs.getWidth(),bufImgs.getHeight(),data[i]);    
    

提交回复
热议问题