I'm using batik to convert an existing svg file to a png. Unfortunately, the png output is low quality. The text and images are both fuzzy. I haven't been able to find anywhere that can show me how to maximize the quality in this process. Does anyone have any ideas?
SVGConverter svgConverter = new SVGConverter();
svgConverter.setMaxWidth(580);
svgConverter.setDestinationType(DestinationType.PNG);
svgConverter.setSources(new String[]{ svgSource.toURI().toURL().toString() });
svgConverter.setDst(outputPng);
svgConverter.execute();
I had a similar problem, and after much wailing and gnashing of teeth, I found that it made a difference which JVM I was running (try java -version
)
Sun's Java SE (build 1.6.0_24-b07) gave me decent results. The 'standard' JVM installed on my Linux version (CentOS): OpenJDK IcedTea6 1.9.8 gave disappointing results.
I actually doubt that it's the JVM, it's more likely to be some library provided with the different installations, but I haven't the time or enthusiasm to dig any deeper. I'm just happy that I finally have some credible PNGs!
I hope this is of some use to you.
James