java流转换BufferedImage转为InputStream

BufferedImage转为InputStream
public InputStream bufferedImageToInputStream(BufferedImage image) throws IOException {
ByteArrayOutputStream os = new ByteArrayOutputStream();
ImageIO.write(image, "JPG", os);
return new ByteArrayInputStream(os.toByteArray());
}

posted on 2021-02-03 10:45  贾广祥  阅读(3294)  评论(0)    收藏  举报

导航