rpm -qa|grep libtiff 检查是否已经安装
rpm -qa|grep libpng 检查是否已经安装
rpm -qa|grep libjpeg 检查是否已经安装
rpm -qa|grep freetype 检查是否已经安装
rpm -qa | grep ImageMagick 检查是否已经安装
rpm -qa | grep Jmagick 检查是否已经安装
卸载老版本(对应系统安装的版本号)
rpm -e -allmatches -nodeps ImageMagick-6.2*
rpm -e --allmatches jmagick-6.4.0-3
下载
下载地址: http://downloads.jmagick.org/6.4.0/ImageMagick-6.4.0-0.tar.gz
安装
解压
[root@localhost bluesea]# tar -zxvf ImageMagick-6.4.0-0.tar.gz
进入解压目录
[root@localhost bluesea]# cd ImageMagick-6.4.0
配置安装参数
[root@localhost ImageMagick-6.4.0]# ./configure --prefix=/usr/local/ImageMagick
Option Value ------------------------------------------------------------------------------- Shared libraries --enable-shared=yes yes Static libraries --enable-static=yes yes Module support --with-modules=yes yes GNU ld --with-gnu-ld=yes yes Quantum depth --with-quantum-depth=16 16 High Dynamic Range Imagery --enable-hdri=no no Delegate Configuration: BZLIB --with-bzlib=yes no DJVU --with-djvu=no no DPS --with-dps=yes no FlashPIX --with-fpx=yes no FontConfig --with-fontconfig=yes no FreeType --with-freetype=yes no GhostPCL None pcl6 (unknown) GhostXPS None gxps (unknown) Ghostscript None gs (8.15.2) result_ghostscript_font_dir='none' Ghostscript fonts --with-gs-font-dir=default Ghostscript lib --with-gslib=yes no Graphviz --with-gvc=yes no JBIG --with-jbig=yes no JPEG v1 --with-jpeg=yes no JPEG-2000 --with-jp2=yes no LCMS --with-lcms=yes no LQR --with-lqr=no no Magick++ --with-magick-plus-plus=yes yes OpenEXR --with-openexr=yes no PERL --with-perl=yes /usr/bin/perl PNG --with-png=yes no RSVG --with-rsvg=yes no TIFF --with-tiff=yes no result_windows_font_dir='none' Windows fonts --with-windows-font-dir= WMF --with-wmf=yes no X11 --with-x= yes XML --with-xml=yes no ZLIB --with-zlib=yes no
发现上面 JPEG,PNG 支持都是 no
解决:到系统安装源目录找到如下3个包并安装(过程略)
zlib-devel-1.2.3-3.x86_64.rpm
libpng-devel-1.2.10-7.1.el5_3.2.x86_64.rpm
libjpeg-devel-6b-37.x86_64.rpm
再次输入
[root@localhost ImageMagick-6.4.0]# ./configure --prefix=/usr/local/ImageMagick
Option Value ------------------------------------------------------------------------------- Shared libraries --enable-shared=yes yes Static libraries --enable-static=yes yes Module support --with-modules=yes yes GNU ld --with-gnu-ld=yes yes Quantum depth --with-quantum-depth=16 16 High Dynamic Range Imagery --enable-hdri=no no Delegate Configuration: BZLIB --with-bzlib=yes no DJVU --with-djvu=no no DPS --with-dps=yes no FlashPIX --with-fpx=yes no FontConfig --with-fontconfig=yes no FreeType --with-freetype=yes no GhostPCL None pcl6 (unknown) GhostXPS None gxps (unknown) Ghostscript None gs (8.15.2) result_ghostscript_font_dir='none' Ghostscript fonts --with-gs-font-dir=default Ghostscript lib --with-gslib=yes no Graphviz --with-gvc=yes no JBIG --with-jbig=yes no JPEG v1 --with-jpeg=yes no (failed tests) JPEG-2000 --with-jp2=yes no LCMS --with-lcms=yes no LQR --with-lqr=no no Magick++ --with-magick-plus-plus=yes yes OpenEXR --with-openexr=yes no PERL --with-perl=yes /usr/bin/perl PNG --with-png=yes no (failed tests) RSVG --with-rsvg=yes no TIFF --with-tiff=yes no result_windows_font_dir='none' Windows fonts --with-windows-font-dir= WMF --with-wmf=yes no X11 --with-x= yes XML --with-xml=yes no ZLIB --with-zlib=yes no
这次提示的是no (failed tests),查看config.log 里面 /usr/bin/ld: cannot find -lX11 显示这样一个错误
解决:到安装源 里面找到如下5个包(安装略)
libX11-devel-1.0.3-11.el5.x86_64.rpm
libXau-devel-1.0.1-3.1.x86_64.rpm
libXdmcp-devel-1.0.1-2.1.x86_64.rpm
mesa-libGL-devel-6.5.1-7.7.el5.x86_64 .rpm
xorg-x11-proto-devel-7.1-13.el5.x86_64.rpm
注意:安装时 这几个包相互依赖 可以加上 --nodpes 参数 安装
再次输入
[root@localhost ImageMagick-6.4.0]# ./configure --prefix=/usr/local/ImageMagick
发现是yes 就可以继续了
编译
[root@localhost ImageMagick-6.4.0]# make
安装
[root@localhost ImageMagick-6.4.0]# make install
配置
[root@localhost ImageMagick-6.4.0]# vi /etc/profile
修改 export PATH=$JAVA_HOME/bin:/usr/local/ImageMagick/bin:$PATH
使之立即生效
[root@localhost ImageMagick-6.4.0]# source /etc/profile
[root@localhost ImageMagick-6.4.0]# vi /etc/ld.so.conf
[root@localhost ImageMagick-6.4.0]# ldconfig
测试
convert -version 显示版本号
上传一张图片1.jpg
执行 convert 1.jpg -gravity center -extent 200x200 2.jpg 看是否生成2.jpg
JMagick安装
下载地址:http://downloads.jmagick.org/6.4.0/jmagick-6.4.0-src.tar.gz
安装
解压
[root@localhost bluesea]# tar -zxvf jmagick-6.4.0-src.tar.gz
安装配置
[root@localhost bluesea]# cd 6.4.0/ [root@localhost 6.4.0]# ./configure --prefix=/usr/local/jmagick --with-magick-home=/usr/local/ImageMagick --with-java-home=/usr/java/jdk1.6.0_30/
编译
[root@localhost 6.4.0]# make
安装
[root@localhost 6.4.0]# make install
配置
把libJMagick.so拷贝到 jdk的amd64目录里
[root@localhost 6.4.0]# cp /usr/local/jmagick/lib/libJMagick.so /usr/java/jdk1.6.0_30/jre/lib/amd64/
将jmagick.jar拷贝到jdk的ext目录下
[root@localhost 6.4.0]# cp /usr/local/jmagick/lib/jmagick-6.4.0.jar /usr/java/jdk1.6.0_30/jre/lib/ext/