php - Imagick convert SVG to PNG - colors replaced by black and white -
i'am trying convert svg image created svggraph library ( http://www.goat1000.com/svggraph.php).
the svg colored (red, green, yellow, gray, ...) in browser , fine. when convert it, black , white.
with code convert it:
//new instance of imagick $im = new imagick(); //read svg file/data (its not saved on filesystem) $im->readimageblob($svgfile); $im->setimageformat("png24"); $im->writeimage('cylinder.png'); $im->clear(); $im->destroy();
i've tried jpeg , png output format result same, colors replaced black
does have idea how fix ?
try way:
$im = new imagick(); $im->setbackgroundcolor(new imagickpixel('transparent')); $im->readimageblob($svgfile); $im->setimageformat("png24"); $im->writeimage('cylinder.png'); $im->clear(); $im->destroy()
Comments
Post a Comment