Page 1 of 1

svg problems

Posted: 2018-07-08T08:18:07-07:00
by ingot
Hello,
I try to use imagick (imagemagick) to convert a SVG to a PNG image. I use the code

Code: Select all

$im = new Imagick();
$im->setBackgroundColor(new ImagickPixel('transparent'));
$im->readimage($blumsvg);

$im->setImageFormat("png32");
$im->resizeImage(200, 200, imagick::FILTER_LANCZOS, 0);
$im->writeimage($blumpng); //Image with transparent background

$im->clear();
$im->destroy();
I also tried to use with blob function. Same result. Also tried png24 and tried without resize. Every time the same result. (See attachment).
what I do wrong, or is ImageMagick not good for svg conversion?
ingo5.png
ingo5.png (1.26 KiB) Viewed 75271 times

Re: svg problems

Posted: 2018-07-08T10:44:44-07:00
by fmw42
Post your original SVG file. Also always provide your Imagemagick version and platform? What do you get from convert -version?

Which SVG renderer are you using? Inkscape, RSVG delegate or Imagemagick MSVG/XML?

If you do not know, then check

convert -list format

And see what it says for SVG on the right side?

Inkscape is the best, but RSVG is a close second. Imagemagick's MSVG is not as good. Whatever you use or get, install the latest version.