【发布时间】:2013-08-29 04:15:03
【问题描述】:
我正在尝试转换由 SVGGraph 库 (http://www.goat1000.com/svggraph.php) 创建的 SVG 图像。
SVG 在浏览器中是彩色的(红色、绿色、黄色、灰色……),一切都很好。但是当我转换它时,它只是黑白的。
我用这段代码转换它:
//new instance of imagick
$im = new Imagick();
//read the svg file/data (its not saved on the filesystem)
$im->readImageBlob($svgFile);
$im->setImageFormat("png24");
$im->writeImage('cylinder.png');
$im->clear();
$im->destroy();
我试过用jpeg和png作为输出格式,结果是一样的,所有颜色都会被替换成黑色
有人知道如何解决这个问题吗?
【问题讨论】:
-
我不熟悉 SVGGraph,但您是否检查过 SVG 文件是否 100% 有效?另外,检查stackoverflow.com/questions/4809194/…,它可能会给你一些想法。
标签: php image svg imagick svggraph