Image to Buffer

来源:互联网 时间:1970-01-01

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();

}



相关阅读:
Top