Right ImageMagick convert svg to png by php from yr.no

Viewed 95

have problem to convert svg to png Meteogramm at svg https://www.yr.no/en/content/67.568007,33.391146/meteogram.svg

i make:

$svg = file_get_contents($url);

$im = new Imagick();
$im->readImageBlob('<?xml version="1.0" encoding="UTF-8" standalone="no"?>'.$svg);

$im->setImageFormat("png24");

header('Content-Type: image/png');
echo $im;

$imagic->clear();
$imagic->destroy();

but it view: my png result

Something not enought... my imageMagick setup PHP Version 7.4.3

Please help.

1 Answers

Your ImageMagick is using its internal MSVG to render. That is the least effective of the 3 choices: MSVG, RSVG delegate and Inkscape. I suggest putting Inkscape on your system so that ImageMagick can find it.

In my system using Inkscape for conversion in ImageMagick:

convert meteogram.svg meteogram.svg

enter image description here

Related