svg problems

IMagick is a native PHP extension to create and modify images using the ImageMagick API. ImageMagick Studio LLC did not write nor does it maintain the IMagick extension, however, IMagick users are welcome to discuss the extension here.
Post Reply
ingot
Posts: 1
Joined: 2018-07-08T08:13:04-07:00
Authentication code: 1152

svg problems

Post 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 75723 times
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: svg problems

Post 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.
Post Reply