Display a Graphics2D as JPG in JSP
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.
精彩评论