Image to Buffer

来源:转载

private byte[] getPhoto()
throws Exception {
final String ICON_EXT = "png";
String file ="D://workspace//OSL//trunk//learning-tool//Web//public_html//images//chart.png";

BufferedImage orgImage = ImageIO.read(new FileInputStream(file));
ByteArrayOutputStream o = new ByteArrayOutputStream();
ImageIO.write(orgImage, ICON_EXT, o);

return o.toByteArray();

}



分享给朋友:
您可能感兴趣的文章:
随机阅读: