Can a BufferedImage be written to file any format?

半腔热情 提交于 2020-01-11 14:16:46

问题


Is it correct that if we have a BufferedImage object in java, we could potentially write it out in ANY format using ImageIO.write (if we have a Writer object for the same)? I tried writing a BufferedImage object into a jpg file, it outputted an empty image file however when i tried writing it in to a png file, it worked fine.


回答1:


A BufferedImage can be written into any format that ImageIO.write supports (that is, has an ImageWriter available), yes. Please show the code if you can't get it to work.



来源:https://stackoverflow.com/questions/2543275/can-a-bufferedimage-be-written-to-file-any-format

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!