欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  后端开发

ImageMagick安装说明(新手必备)

程序员文章站 2022-05-02 08:29:45
...
  1. tar -xzvf tiff-3.8.0.tar.gz
  2. cd tiff-3.8.0
  3. ./configure
  4. make
  5. make install
复制代码

我安装完成后,在命令行处理图片,报错:libtiff.so.3: cannot open shared object file: No such file or directory 此模块也用不到,可以不安装。

3、安装jasper包: 下载地址:http://www.ece.uvic.ca/~mdadams/jasper/ 安装后才能处理JPEG2000格式图片(文件扩展名是 .jp2 .j2c)

  1. unzip jasper-1.900.1.zip
  2. cd jasper-1.900.1
  3. CFLAGS=-fPIC ./configure
  4. make CFLAGS=-fPIC
  5. make CFLAGS=-fPIC install
复制代码

4、安装jpeg包 下载地址:http://www.ijg.org/files/jpegsrc.v6b.tar.gz

  1. #安装jpeg
  2. cd /disk/src
  3. tar -xzf ../soft/jpegsrc.v6b.tar.gz
  4. cd jpeg-6b/
  5. ./configure
  6. make && make install
复制代码

5、安装zlib 下载地址 http://zlib.net/zlib-1.2.7.tar.gz

  1. cd /disk/src
  2. tar -xzf ../soft/zlib-1.2.7.tar.gz
  3. cd cd zlib-1.2.7
  4. ./configure
  5. make && make install
复制代码

6、安装png 下载地址:http://www.libpng.org/pub/png/pngcode.html

  1. wget ftp://ftp.simplesystems.org/pub/libpng/png/src/libpng-1.2.50.tar.gz

  2. cd /disk/src

  3. tar -xzf ../soft/libpng-1.2.50.tar.gz
  4. cd libpng-1.2.50
  5. cp scripts/makefile.std makefile
  6. make
  7. make install
复制代码

7、安装freetype 下载地址: http://www.freetype.org/ http://download.savannah.gnu.org/releases/freetype/freetype-2.4.9.tar.gz

  1. cd /disk/src
  2. tar -xzf ../soft/freetype-2.4.9.tar.gz
  3. cd freetype-2.4.9
  4. ./configure
  5. make
  6. make install
复制代码

8、安装ImageMagick

  1. #宣告64位环境

  2. export CFLAGS=’-fPIC’
  3. tar -xzf ../soft/ImageMagick-6.8.0-0.tar.gz
  4. cd ImageMagick-6.8.0-0/
  5. ./configure --with-quantum-depth=8 --enable-share --enable-static
  6. make all
  7. make install
  8. /usr/bin/ld: skipping incompatible /usr/lib/libpthread.a when searching for -lpthread

  9. /usr/bin/ld: cannot find -lltdl
  10. collect2: ld returned 1 exit status
  11. libtool: install: error: relink `magick/libMagickCore.la' with the above command before installing it
  12. make[2]: *** [install-libLTLIBRARIES] 错误 1
  13. make[2]: Leaving directory `/disk/src/ImageMagick-6.8.0-0'
  14. install: error: relink `magick/libMagickCore.la' with the above command before installing it

  15. /usr/bin/ld: cannot find -lltdl

复制代码

解决方法: usr/bin/ld: cannot find错误的解决方法 二、二进制RPM安装

1、先卸载后安装 安装:

  1. yum install ImageMagick ImageMagick-devel
复制代码

如果已安装过,先执行下面的卸载命令,我已安装过6.2.8版本,所以要先卸载。

  1. [root@jbxue soft]# convert --version
  2. Version: ImageMagick 6.2.8 05/07/12 Q16 file:/usr/share/ImageMagick-6.2.8/doc/index.html
  3. Copyright: Copyright (C) 1999-2006 ImageMagick Studio LLC
  4. [root@jbxue soft]# rpm -qa| grep ImageMagick
  5. ImageMagick-devel-6.2.8.0-15.el5_8
  6. ImageMagick-6.2.8.0-15.el5_8
  7. ImageMagick-devel-6.2.8.0-15.el5_8
  8. ImageMagick-6.2.8.0-15.el5_8
复制代码

卸载:yum erase ImageMagick 或 yum remove ImageMagick。

2、安装基础库

  1. yum install libtool-ltdl libtool-ltdl-devel freetype freetype-devel fontconfig-devel
  2. wget http://centos.ustc.edu.cn/epel/5/x86_64/epel-release-5-4.noarch.rpm
  3. rpm -Uvh epel-release-5-4.noarch.rpm
  4. yum --enablerepo=epel install jasper jasper-libs jasper-devel
复制代码

3、安装ImageMagick-6.8.0-0.x86_64.rpm

下载地址: http://www.imagemagick.org/script/binary-releases.php#unix

  1. wget ftp://ftp.imagemagick.org/pub/ImageMagick/linux/CentOS/x86_64/ImageMagick-6.8.0-0.x86_64.rpm

  2. wget ftp://ftp.imagemagick.org/pub/ImageMagick/linux/CentOS/x86_64/ImageMagick-devel-6.8.0-0.x86_64.rpm
  3. rpm -Uvh ImageMagick-6.8.0-0.x86_64.rpm

复制代码

出现错误:

  1. yum install --nogpgcheck ImageMagick-6.8.0-0.x86_64.rpm
复制代码

4、检测安装结果

  1. [root@jbxue soft]# convert --version

  2. Version: ImageMagick 6.8.0-0 2012-10-11 Q16 http://www.imagemagick.org

  3. Copyright: Copyright (C) 1999-2012 ImageMagick Studio LLC
  4. Features: OpenMP
复制代码

三、参考资料 http://www.imagemagick.org/script/download.php http://www.imagemagick.org/script/index.php