如何在 Java/Groovy 中将 InputStream 转换为 BufferedImage?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6464432/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-16 06:11:26 来源:igfitidea点击:
How do I convert a InputStream to BufferedImage in Java/Groovy?
提问by Dycey
Yes, I'm that stupid. I'm trying to stick some groovy code together from various cookbook recipes, and I can't get from an InputStream to BufferedImage in Java/Groovy. Google is not being my friend at present.
是的,我就是这么傻。我正在尝试将各种食谱中的一些 groovy 代码粘在一起,但我无法在 Java/Groovy 中从 InputStream 获取到 BufferedImage。谷歌目前不是我的朋友。
采纳答案by Gans
BufferedImage imBuff = ImageIO.read(object.getInputStream());
Should work...
应该管用...