public static byte[] imageToByte(BufferedImage bi,String format) throws IOException
{
ByteArrayOutputStream baos=new ByteArrayOutputStream();
ImageIO.write(bi, format, baos);
return baos.toByteArray();
}
//exp:
byte[] b=imageToByte(bi,"jpeg");
本文介绍了一段Java代码,该代码演示了如何将BufferedImage转换为字节数组,适用于JPEG格式。此方法利用了Java的ImageIO类进行图像处理。
转载于:https://www.cnblogs.com/cshF3220544/archive/2009/06/16/1504009.html

被折叠的 条评论
为什么被折叠?