Java中Image类型转换成 Byte数组

Java服务端,通过WebService传送image.将image转换为Byte数组:


BufferedImage bufimg;
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ImageIO.write(bufimg,"jpg",baos);
byte[] by = baos.toByteArray();
 

C#客户端,将Byte[]转换成Image:

 

byte[] by = iVerifyCode.getVerifyImg();// 调用WebService服务iVerifyCode,获得byte数组
Image img = Image.FromStream(new MemoryStream(by));
 

 

你可能感兴趣的:(image)