Converting SVG to PNG with Imagick messed up text
When using the following code to convert SVG to PNG file, the text looks terrible. The image is not scalable, so I have no idea why the text quality is so bad.
Also, while difficult to understand, text in PNG appears to be a serif font, while text in SVG is sans-serif.
Edit: I just noticed that the special characters seem to be messed up in the word "Kreuzwortrรคtsel".
What can I do to fix the problems?
$image = new Imagick();
$image->setResolution(288, 288);
$image->readImageBlob($svg);
$image->setImageformat('png24');
header('Content-Type: image/png');
echo $image->getImageBlob();
This is SVG: https://www.dropbox.com/s/22hewf59cmcv92k/SVG.svg?dl=0
This is the converted PNG: https://www.dropbox.com/s/c5mihvmmlyu9kx8/PNG.png?dl=0
The quality problem is hard to see in the minified version, check the link above.
Imagick::getVersion()
returns ImageMagick 6.8.9-7 Q16 x86_64 2015-04-09 http://www.imagemagick.org .
source to share
You are almost certainly using a converter that has a bug.
Using your code and original image, I convert the image just fine, using Ghostscript version 8.70 as the "delegate decoding" that ImageMagick will use to actually convert.
You should try to update whatever is actually used by the delegate. If you are using Ghostscript I recommend upgrading to 9.x if possible as there are many other bug fixes in this.
source to share