![ContractedBlock.gif](https://www.cnblogs.com/Images/OutliningIndicators/ContractedBlock.gif)
![ExpandedBlockStart.gif](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif)
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");
转载于:https://www.cnblogs.com/cshF3220544/archive/2009/06/16/1504009.html