我正在尝试将 myBufferedImage
转换为整数数组,但出现以下错误:“java.awt.image.DataBufferByte
无法转换为java.awt.image.DataBufferInt
”
这是我的一段代码:
public class Test {
public static void main (String [] args) {
BufferedImage img = null;
try {
img = ImageIO.read(new File("G.bmp"));
} catch (IOException e) { }
int[] imgarray = ((DataBufferInt)img.getRaster().getDataBuffer()).getData();
}
}