BufferedImage转成InputStream

时间:2016-01-09 00:52:52   收藏:0   阅读:858

 

怎样将BufferedImage转成InputStream

    public InputStream getImageStream(BufferedImage bimage){
        InputStream is = null;
        ByteArrayOutputStream bs = new ByteArrayOutputStream();
        ImageOutputStream imOut;
        try {
        imOut = ImageIO.createImageOutputStream(bs);
        ImageIO.write(bimage, "png",imOut);
        is= new ByteArrayInputStream(bs.toByteArray());
        } catch (IOException e) {
        e.printStackTrace();
        }
        return is;
        }

 

原文:http://www.cnblogs.com/hzzhero/p/5115222.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!