开发者

Display a Graphics2D as JPG in JSP

开发者 https://www.devze.com 2023-03-15 06:07 出处:网络
Is it possible to use Graphics2D in a servlet? And if I have a Graphics2D object, is it possible for me to convert it to a .jpg image and displ开发者_Go百科ay it in a JSP page?In my opinion yes, Rea

Is it possible to use Graphics2D in a servlet?

And if I have a Graphics2D object, is it possible for me to convert it to a .jpg image and displ开发者_Go百科ay it in a JSP page?


In my opinion yes, Read the link for better understanding.


JFreeChart has a good example of doing this. To accommodate older versions, it provides a org.jfree.chart.encoders.SunJPEGEncoderAdapter. The encode() method shows how to use ImageIO for either byte array or stream.

0

精彩评论

暂无评论...
验证码 换一张
取 消