private static final Logger logger = Logger.getLogger(Demo.class);

/**
* 将BufferedImage转换为InputStream
* @param image
* @return
*/
public InputStream bufferedImageToInputStream(BufferedImage image){
ByteArrayOutputStream os = new ByteArrayOutputStream();
try {
ImageIO.write(image, "png", os);
InputStream input = new ByteArrayInputStream(os.toByteArray());
return input;
} catch (IOException e) {
logger.error("提示:",e);
}
return null;
}

相关文章:

  • 2021-09-16
  • 2022-02-05
  • 2022-12-23
  • 2021-11-26
  • 2022-12-23
  • 2022-01-28
  • 2021-08-04
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-06-25
  • 2022-12-23
  • 2021-11-17
  • 2021-06-19
  • 2021-10-05
  • 2022-12-23
相关资源
相似解决方案