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 .

+3


source to share


2 answers


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.

0


source


SVG refers exclusively to, I think, the font Verdana

. Check if your ImageMagick system knows this font using:

identify -list font | more

      

or



identify -list font | grep -i verdana

      

If ImageMagick doesn't know this font, see my other post here .

0


source







All Articles