Linux下简单安装ImageMagick
2014-12-29 18:23
399 查看
ImageMagick是Linux下常用的一款功能强大的图像软件。其实它并非Linux的专属,它也有Windows安装版。本文只关注Linux版本。
下载源代码:ImageMagick.tar.gz,下载地址:http://www.imagemagick.org/script/install-source.php
安装步骤:
将下载的文件放到/usr/local/src目录下,
解压
test@test:/usr/local/src$
sudo tar -xvf ImageMagick.tar.gz
配置
test@test:/usr/local/src/ImageMagick-6.9.0-2$
sudo ./configure --prefix=/usr/local/ImageMagick-6.9.0-2
编译
test@test:/usr/local/src/ImageMagick-6.9.0-2$
sudo make
安装
test@test:/usr/local/src/ImageMagick-6.9.0-2$
sudo make install
安装完成。
添加系统环境路径:
test@test:/usr/local/ImageMagick-6.9.0-2/bin$
sudo gedit /etc/profile
在打开的文件中,添加一行:
export
PATH=$PATH:/usr/local/ImageMagick-6.9.0-2/bin
执行:
test@test:/usr/local/ImageMagick-6.9.0-2/bin$
source /etc/profile
查看路径是否添加成功:
test@test:/usr/local/ImageMagick-6.9.0-2/bin$
echo $PATH
/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/cmake-3.1.0/bin:/usr/local/ImageMagick-6.9.0-2/bin
测试一下截图功能是否可用:
test@test:~/Downloads$import
-pause 3 test.jpg
到~/Downloads/目录下双击打开test.jpg图片,无法打开,显示错误:
试图通过命令行打开:
报错:import:
no decode delegate for this image format `test.jpg' @ error/constitute.c/ReadImage/552.
Reason:
Missing
the decoding library. Apparently you need to install it and then recompile ImageMagick to work with Jpg files.
解决方案:
1.
Go to: http://www.imagemagick.org/download/delegates/
and download the required/missing delegate library. Here I downloaded "jpegsrc.v9a.tar.gz".
2.
Put "jpegsrc.v9a.tar.gz" into directory "/usr/local/src"
3.
Go to /usr/local/src, and extract:
test@test:/usr/local/src$sudo
tar -xvf jpegsrc.v9a.tar.gz
4.
The extracted folder name is "/jpeg-9a", execute the following commands to install:
test@test:/usr/local/src/jpeg-9a$sudo
./configure
test@test:/usr/local/src/jpeg-9a$sudo
make install
5.
Reinstall ImageMagick. (重复之前的安装步骤和添加/usr/local/ImageMagick-6.9.0-2/bin到系统PATH)
重装之后,再测试:
test@test:/usr/local/ImageMagick-6.9.0-2/bin$
import ~/Downloads/567.jpg
import:
error while loading shared libraries: libjpeg.so.9: cannot open shared object file: No such file or directory
或者
test@test:/usr/local/ImageMagick-6.9.0-2/bin$
import -pause 3 ~/test.jpg
import: error while loading shared libraries: libMagickCore-6.Q16.so.2: cannot open shared object file: No such file or directory
错误跟之前不一样。这个错误解决方法如下:
test@test:/usr/local/ImageMagick-6.9.0-2/bin$
cd ../lib/
test@test:/usr/local/ImageMagick-6.9.0-2/lib$
pwd
/usr/local/ImageMagick-6.9.0-2/lib
test@test:/usr/local/ImageMagick-6.9.0-2/lib$
sudo ldconfig /usr/local/ImageMagick-6.9.0-2/lib
其实就是添加the
shared libraries from the new directory “/usr/local/ImageMagick-6.9.0-2/lib” 到the shared library cache。详细原理:To
fix this problem, we need to add the library directory to the list used by ldconfig and run it again to rebuild its cache with the shared library files found in the new directory.http://choorucode.com/2014/01/14/how-to-add-library-directory-to-ldconfig-cache/
再次执行:
test@test:/usr/local/ImageMagick-6.9.0-2/lib$
import ~/Downloads/test.jpg
不再有错误。打开看看:
test@test:/usr/local/ImageMagick-6.9.0-2/lib$
display ~/Downloads/test.jpg
也可以正常打开了。
进文件夹双击图片,显示也正常打开了:
参考:
http://www.imagemagick.org/script/install-source.php
http://blog.ericlamb.net/2008/11/fix-for-convert-no-decode-delegate-for-this-image-format/¥
下载源代码:ImageMagick.tar.gz,下载地址:http://www.imagemagick.org/script/install-source.php
安装步骤:
将下载的文件放到/usr/local/src目录下,
解压
test@test:/usr/local/src$
sudo tar -xvf ImageMagick.tar.gz
配置
test@test:/usr/local/src/ImageMagick-6.9.0-2$
sudo ./configure --prefix=/usr/local/ImageMagick-6.9.0-2
编译
test@test:/usr/local/src/ImageMagick-6.9.0-2$
sudo make
安装
test@test:/usr/local/src/ImageMagick-6.9.0-2$
sudo make install
安装完成。
添加系统环境路径:
test@test:/usr/local/ImageMagick-6.9.0-2/bin$
sudo gedit /etc/profile
在打开的文件中,添加一行:
export
PATH=$PATH:/usr/local/ImageMagick-6.9.0-2/bin
执行:
test@test:/usr/local/ImageMagick-6.9.0-2/bin$
source /etc/profile
查看路径是否添加成功:
test@test:/usr/local/ImageMagick-6.9.0-2/bin$
echo $PATH
/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/cmake-3.1.0/bin:/usr/local/ImageMagick-6.9.0-2/bin
测试一下截图功能是否可用:
test@test:~/Downloads$import
-pause 3 test.jpg
到~/Downloads/目录下双击打开test.jpg图片,无法打开,显示错误:
试图通过命令行打开:
display ~/Pictures/test.jpg
报错:import:
no decode delegate for this image format `test.jpg' @ error/constitute.c/ReadImage/552.
Reason:
Missing
the decoding library. Apparently you need to install it and then recompile ImageMagick to work with Jpg files.
解决方案:
1.
Go to: http://www.imagemagick.org/download/delegates/
and download the required/missing delegate library. Here I downloaded "jpegsrc.v9a.tar.gz".
2.
Put "jpegsrc.v9a.tar.gz" into directory "/usr/local/src"
3.
Go to /usr/local/src, and extract:
test@test:/usr/local/src$sudo
tar -xvf jpegsrc.v9a.tar.gz
4.
The extracted folder name is "/jpeg-9a", execute the following commands to install:
test@test:/usr/local/src/jpeg-9a$sudo
./configure
test@test:/usr/local/src/jpeg-9a$sudo
make install
5.
Reinstall ImageMagick. (重复之前的安装步骤和添加/usr/local/ImageMagick-6.9.0-2/bin到系统PATH)
重装之后,再测试:
test@test:/usr/local/ImageMagick-6.9.0-2/bin$
import ~/Downloads/567.jpg
import:
error while loading shared libraries: libjpeg.so.9: cannot open shared object file: No such file or directory
或者
test@test:/usr/local/ImageMagick-6.9.0-2/bin$
import -pause 3 ~/test.jpg
import: error while loading shared libraries: libMagickCore-6.Q16.so.2: cannot open shared object file: No such file or directory
错误跟之前不一样。这个错误解决方法如下:
test@test:/usr/local/ImageMagick-6.9.0-2/bin$
cd ../lib/
test@test:/usr/local/ImageMagick-6.9.0-2/lib$
pwd
/usr/local/ImageMagick-6.9.0-2/lib
test@test:/usr/local/ImageMagick-6.9.0-2/lib$
sudo ldconfig /usr/local/ImageMagick-6.9.0-2/lib
其实就是添加the
shared libraries from the new directory “/usr/local/ImageMagick-6.9.0-2/lib” 到the shared library cache。详细原理:To
fix this problem, we need to add the library directory to the list used by ldconfig and run it again to rebuild its cache with the shared library files found in the new directory.http://choorucode.com/2014/01/14/how-to-add-library-directory-to-ldconfig-cache/
再次执行:
test@test:/usr/local/ImageMagick-6.9.0-2/lib$
import ~/Downloads/test.jpg
不再有错误。打开看看:
test@test:/usr/local/ImageMagick-6.9.0-2/lib$
display ~/Downloads/test.jpg
也可以正常打开了。
进文件夹双击图片,显示也正常打开了:
参考:
http://www.imagemagick.org/script/install-source.php
http://blog.ericlamb.net/2008/11/fix-for-convert-no-decode-delegate-for-this-image-format/¥
相关文章推荐
- Linux下的vsftpd1.2.1的简单安装和配置
- 在win下打造linux环境: cygwin的安装和简单配置
- VMware下Linux的安装及简单设置
- Linux下FTP服务器的安装和简单配置 推荐
- linux PHP安装(方便简单快捷)
- linux系统管理.系统的安装后的简单配置
- 最简单的linux上的pptpd服务器安装
- Linux系统安装与硬盘分区简单介绍
- Linux下ImageMagick和JMagick的安装配置
- Linux代理服务器Squid简单配置及安装时遇到的问题
- 在win下打造linux环境: cygwin的安装和简单配置
- 在硬盘中安装Linux操作系统最简单的方法
- Linux下Apache2.0简单安装、配置、测试过程
- 编译和安装linux内核2.6.x,一个简单的内核驱动测试
- VMware下Linux的安装及简单设置
- 在Linux上安装ImageMagick和JMagick
- linux下的ImageMagick安装
- Tomcat 6.0在Linux操作系统上的简单安装
- Linux简单安装Mysql+Apach+PHP+phpMyAdmin
- 编译和安装linux内核2.6.24,并且写一个简单的内核驱动测试之