BufferedImage与byte数组之间的转换

把一个BufferedImage图像转换为数组

 BufferedImage   srcImage   =   ImageIO.read(new   File( "c:/**.jpg "));  

    byte[]   data   =   ((DataBufferByte)  srcImage.getData().getDataBuffer()).getData();

通过byte数组再次得到图片

BufferedImage   srcImage      =   robot.createScreenCapture(rec);

 用字节数组来保存图片

BufferedImage   bi=ImageIO.read(new   ByteArrayInputSream(byte[]);  
ImageIO.write(bufferedImage, "gif ",new   ByteArrayOutputStream(new   byte[20000]));
 

你可能感兴趣的:(C++,c,C#)