我通过命令行使用ImageMagick将简单的SVG转换为具有透明背景的PNG,但由于某种原因它无法正常工作.
我已经尝试了一些注意的建议在这里(包括convert -background none in.svg out.png和convert -background transparent in.svg out.png),但没有运气.
这是SVG的来源:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns="http://www.w3.org/2000/svg"
width="130" height="130"
stroke-width="8"
stroke="#303030" stroke-linejoin="round"
style="background-color: rgba(255,255,255,0);"
>
<g transform="translate(65,65)">
<path fill="red" d="M60,0 h-120 a60,60 0 0 1 120,0" />
<path fill="white" d="M60,0 h-120 a60,60 0 0 0 120,0" />
<circle fill="white" r="20" />
<circle stroke-width="2" fill="white" r="10" />
</g>
</svg>
Run Code Online (Sandbox Code Playgroud)
这是ImageMagick的版本输出convert(在Mac OS X 10.7.3上运行):
calyodelphi@dragonpad:~/pokemon-story $ convert -version
Version: ImageMagick 6.8.9-0 Q16 x86_64 2014-04-22 …Run Code Online (Sandbox Code Playgroud) 我可以访问带有多个用户帐户的 CentOS Web 服务器。这些用户可以在他们自己的文件系统分支中的任何地方拥有 php.ini 文件——而不仅仅是在他们的主目录中。我试图找到一种简单而优雅的方法(最好使用 bash 实用程序)来测试 php.ini 文件是否存在于文件系统的单个用户分支中的任何位置。
下面的示例显示了我能够设计的仅有的两种方法,但每种方法都有其缺点,使它们无法使用:
# Does not work as intended
# Always echoes "Found" because find returns 0 even if it didn't find php.ini
if find . -name php.ini; then echo "Found"; fi
# Does not work if php.ini is in a subdirectory
# This test only works on the current working directory
if [ -e php.ini ]; then echo "Found"; fi
Run Code Online (Sandbox Code Playgroud)
假设当前工作目录是~(/home/user),php.ini文件在~/public_html,则每个输出如下:
# First, if the php.ini is named php.ini:
cdsynth@cdsynthetics.com [~]# …Run Code Online (Sandbox Code Playgroud)