CentOS安装GraphicsMagick

安装相关依赖

yum install -y gcc libpng libjpeg libpng-devel libjpeg-devel ghostscript libtiff libtiff-devel freetype freetype-devel

下载并解压

wget ftp://ftp.graphicsmagick.org/pub/GraphicsMagick/1.3/GraphicsMagick-1.3.29.tar.gz
tar -zxvf GraphicsMagick-1.3.29.tar.gz

编译并安装

cd /usr/local/GraphicsMagick-1.3.29
./configure --prefix=/usr/local/GraphicsMagick-1.3.29
make
make install

设置环境变量

echo 'PATH=$PATH:$GMAGICK_HOME/bin' > /etc/profile.d/graphicsmagick.sh && source /etc/profile

检查是否安装成功

gm version

查看支持的图片列表

gm convert -list formats