How to replace com.sun.image.codec.jpeg.JPEGImageEncoder in this code?

时间秒杀一切 提交于 2019-11-27 18:59:48

Use ImageIO, it can read/write JPEG, PNG, GIF, and BMP out of the box.

ImageIO.write(ChartImage, "jpeg", out);

Usually the static write(...) and read(...) methods are enough, if you need to control compression or handle image meta data, check out the Java Image I/O API Guide.

Classes from the com.sun.** packages should never be used. Use ImageIO to encode images into bytes.

Read the ImageIO tutorial.

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