imageMagick无法正常工作,将SVG(也具有蒙版图像的SVG)转换为PNG [英] imageMagick not working, to convert the SVG (SVG having mask image also) to PNG
问题描述
我试图将SVG转换为PNG图像,但无法正常工作, 使用此链接进行了测试, 但是它正在创建白色图像,如果我用过
I have tried to convert SVG to PNG image but it's not working, Tested using this link, but it's creating the white image and if I used
$image->setBackgroundColor(new ImagickPixel('transparent'));
它创建了黑色/透明图像
$image->setBackgroundColor(new ImagickPixel('transparent'));
it created the black/transparent image
SVG图片:浏览器上的SVG图片实际视图 转换后:将SVG转换为PNG
SVG image : SVG image actual view on browser After converting: SVG to PNG
带掩码的SVG:示例
推荐答案
鉴于所有下载到我计算机上的数据,我可以使用ImageMagick 6.9.10.82 Q16 Mac OSX Sierra(将Inkscape 0.92.4称为SVG)将其转换为png.渲染器.
Given all your data downloaded to my computer, I can convert it to png using ImageMagick 6.9.10.82 Q16 Mac OSX Sierra that calls Inkscape 0.92.4 as the SVG renderer.
convert right.inside.svg x.png
您没有显示正确的结果.所以我不知道这是否正确.但是考虑到Assets文件夹中的图像,这似乎是正确的.
You have not shown the correct result. So I do not know if this is correct or not. But it does appear to be correct given the images in the assets folder.
但是,无论谁试图查看svg文件,都必须可以访问遮罩和其他图像.因此,要么需要下载数据,要么可能需要在具有svg文件的某些服务器上提供这些文件的URL.
However, the mask and other image needs to be accessible from whomever is trying to view the svg file. So either the data needs to be downloaded or perhaps you need to provide the URL to those files on some server that has the svg file.
这篇关于imageMagick无法正常工作,将SVG(也具有蒙版图像的SVG)转换为PNG的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!