Reputation: 238
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 display it in a JSP page?
Upvotes: 0
Views: 1093
Reputation: 205865
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.
Upvotes: 1