使用RSVG作为默认代理ImageMagick Ubuntu 16.04

时间:2016-06-02 17:19:58

标签: php ubuntu imagemagick

我需要使用RSVG委托进行转换。

convert -list format | grep SVG
 MSVG  SVG       rw+   ImageMagick's own SVG internal renderer
  SVG  SVG       rw+   Scalable Vector Graphics (XML 2.9.3)
 SVGZ  SVG       rw+   Compressed Scalable Vector Graphics (XML 2.9.3)


identify -list delegate | grep "svg =" 
        svg =>          "rsvg-convert" -o "%o" "%i"

如何将其设置为转换的默认值?

1 个答案:

答案 0 :(得分:1)

我使它像这样工作:

  • 在系统上安装RSVG
  • 使用选项--with-rsvg=yes从源配置和安装ImageMagick

在此处找到更多详细信息: https://gist.github.com/maxivak/1476f7e979879da9f75371a86d5627b5

  1. 检查imagemagick对svg的支持
identify -list configure | grep svg

您应该会看到类似的内容

DISTCHECK_CONFIG_FLAGS  --disable-deprecated  --with-quantum-depth=16  --with-jemalloc=no  --with-umem=no  --with-autotrace=no  --with-gslib=no  --with-fontpath=  --with-rsvg=no  --with-perl=no 

!注意! --with-rsvg=no,这意味着ImageMagick在您的系统中找不到rsvg。

  1. 安装RSVG
sudo apt-get install librsvg2-bin

检查rsvg是否正常

rsvg-convert my.svg > my.png
  1. 使用选项'--with-rsvg = no'从源代码重新安装imagemagick
# download
wget https://imagemagick.org/download/ImageMagick.tar.gz

# untar
tar xvzf ImageMagick.tar.gz

# 
cd ImageMagick-7.0.8

# !!! IMPORTANT. option `--with-srvg=yes` !!!

./configure --with-rsvg=yes

#
make

sudo make install

sudo ldconfig /usr/local/lib

  1. 验证ImageMagick安装是否与SVG正常工作
/usr/local/bin/identify my.svg