1.安装相关依赖:
yum install -y gcc libpng libjpeg libpng-devel libjpeg-devel ghostscript libtiff libtiff-devel freetype freetype-devel
2.下载并解压到目录/usr/local/
wget ftp://ftp.graphicsmagick.org/pub/GraphicsMagick/1.3/GraphicsMagick-1.3.29.tar.gz
tar -zxvf GraphicsMagick-1.3.29.tar.gz
3.编译并安装
cd /usr/local/GraphicsMagick-1.3.29
./configure --prefix=/usr/local/GraphicsMagick-1.3.29
make
make install
4.设置环境变量
vi /etc/profile
在文件的后边追加
GM_HOME=/usr/local/GraphicsMagick-1.3.29
PATH=$GM_HOME/bin:$PATH
export PATH CLASSPATH GM_HOME
保存后执行,使配置生效
source /etc/profile
5.检查是否安装成功
用命令:
convert -version
会显示:
Version: ImageMagick 6.7.2-7 2017-03-22 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2011 ImageMagick Studio LLC
Features: OpenMP
用命令
gm version
会显示:
GraphicsMagick 1.3.29 2018-04-29 Q8 http://www.GraphicsMagick.org/
Copyright (C) 2002-2018 GraphicsMagick Group.
Additional copyrights and licenses apply to this software.
See http://www.GraphicsMagick.org/www/Copyright.html for details.
Feature Support:
Native Thread Safe yes
Large Files (> 32 bit) yes
Large Memory (> 32 bit) yes
BZIP yes
DPS no
FlashPix no
FreeType yes
Ghostscript (Library) no
JBIG no
JPEG-2000 yes
JPEG yes
Little CMS no
Loadable Modules no
OpenMP yes (200805)
PNG yes
TIFF yes
TRIO no
UMEM no
WebP no
WMF no
X11 yes
XML no
ZLIB yes
Host type: x86_64-unknown-linux-gnu
Configured using the command:
./configure '--prefix=/usr/local/GraphicsMagick-1.3.29'
Final Build Parameters:
CC = gcc -std=gnu99
CFLAGS = -fopenmp -g -O2 -Wall -pthread
CPPFLAGS = -I/usr/include/freetype2
CXX = g++
CXXFLAGS = -pthread
LDFLAGS =
LIBS = -ltiff -lfreetype -ljasper -ljpeg -lpng12 -lXext -lSM -lICE -lX11 -lbz2 -lz -lm -lgomp -lpthread
6.im4java 代码设置CMD路径为
/usr/local/GraphicsMagick-1.3.29/bin