I want to embed a PNG of a chart which I created with JFreeChart into a PDF document. The problem here is, that the quality of the chart is very poor. My goal is to have PNGs with 300 DPI. I googled for almost an hour now but I could not find a solution.
Is there a way to export the generated charts from JFreeCharts as a PNG (or a JPEG) with 300 DPI?
Also take a look at org.jfree.chart.ChartUtilities#writeScaledChartAsPNG
If you provide a scale factor of 2, your chart will be rendered at twice the resolution.
Since version 1.4, JFreeChart
uses the png
encoder provided by ImageIO
. As an alternative , you might look at com.keypoint.PngEncoder
, which includes setDpi()
, et al. See also org.jfree.chart.encoders.SunPNGEncoderAdapter
and org.jfree.chart.encoders.KeypointPNGEncoderAdapter
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With