如何在Ubuntu上安装ImageMagick
使用ImageMagick创建、编辑、组合或转换位图像素。它实际上可以读取和写入多种编解码器(超过200种)的快照,包括PNG、JPEG、JPEG-2000、GIF、TIFF、DPX、EXR、WebP、Postscript、PDF和SVG。使用ImageMagick调整大小、翻转、镜像、旋转、扭曲、剪切和开发快照,更改图像颜色,应用各种特效,或绘制文本、线条、多边形、椭圆和贝塞尔曲线。本文介绍了“如何在Ubuntu上安装ImageMagick”。
在安装ImageMagick之前,需要构建必要的组件,如下所示:
$sudo apt-get install build-essential checkinstall && apt-get build-dep imagemagick -y
示例输出如下:
Reading package lists... Done Building dependency tree Reading state information... Done build-essential is already the newest version (12.1ubuntu2). The following NEW packages will be installed: checkinstall 0 upgraded, 1 newly installed, 0 to remove and 204 not upgraded. Need to get 121 kB of archives. After this operation, 516 kB of additional disk space will be used. Do you want to continue? [Y/n] y Get:1 http://in.archive.ubuntu.com/ubuntu xenial/universe amd64 checkinstall amd64 1.6.2-4ubuntu1 [121 kB] Fetched 121 kB in 0s (162 kB/s) ..................................................................................
现在下载ImageMagick,如下所示:
$sudo wget https://imagemagick.org.cn/download/ImageMagick.tar.gz
示例输出如下:
--2017-01-27 11:49:08-- https://imagemagick.org.cn/download/ImageMagick.tar.gz Resolving www.imagemagick.org (www.imagemagick.org)... 198.72.81.86 Connecting to www.imagemagick.org (www.imagemagick.org)|198.72.81.86|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 12746042 (12M) [application/x-gzip] Saving to: ‘ImageMagick.tar.gz’ ImageMagick.tar.gz 100%[===================>] 12.16M 1.28MB/s in 14s 2017-01-27 11:49:22 (907 KB/s) - ‘ImageMagick.tar.gz’ saved [12746042/12746042]
解压下载的文件,如下所示:
$sudo tar xzvf ImageMagick.tar.gz
示例输出如下:
ImageMagick-7.0.4-5/PerlMagick/t/ttf/ ImageMagick-7.0.4-5/PerlMagick/t/ttf/read.t ImageMagick-7.0.4-5/PerlMagick/t/ttf/input.ttf ImageMagick-7.0.4-5/PerlMagick/t/composite.t ImageMagick-7.0.4-5/PerlMagick/t/input.dib ImageMagick-7.0.4-5/PerlMagick/t/input_p5.pgm ImageMagick-7.0.4-5/PerlMagick/t/input_70x46.uyvy ImageMagick-7.0.4-5/PerlMagick/t/input.im8 ImageMagick-7.0.4-5/PerlMagick/t/input.sgi ImageMagick-7.0.4-5/PerlMagick/t/png/ ImageMagick-7.0.4-5/PerlMagick/t/png/input.mng ImageMagick-7.0.4-5/PerlMagick/t/png/write.t ImageMagick-7.0.4-5/PerlMagick/t/png/read-16.t ImageMagick-7.0.4-5/PerlMagick/t/png/input_256.png ImageMagick-7.0.4-5/PerlMagick/t/png/input_bw.png ImageMagick-7.0.4-5/PerlMagick/t/png/input_truecolor.png ImageMagick-7.0.4-5/PerlMagick/t/png/write-16.t ImageMagick-7.0.4-5/PerlMagick/t/png/input_mono.png ..........................................................................
要验证上述命令,请使用以下命令:
$ ls
示例输出如下:
ImageMagick-7.0.4-5 ImageMagick.tar.gz
现在进入解压后的目录,如下所示:
$cd ImageMagick-7.0.4-5
要检查配置,请使用以下命令:
~/ImageMagick-7.0.4-5# ./configure
要构建源代码,请使用以下命令:
~/ImageMagick-7.0.4-5# make clean ~/ImageMagick-7.0.4-5# make ~/ImageMagick-7.0.4-5# checkinstall ~/ImageMagick-7.0.4-5# ldconfig /usr/local/lib
要获取更多关于Magick的信息,请使用以下命令:
$ magick -help
示例输出如下:
Usage: magick [ {option} | {image} ... ] {output_image} magick [ {option} | {image} ... ] -script {filename} [ {script_args} ...] magick -help | -version | -usage | -list {option}
要获取Magick的版本,请使用以下命令:
$ magick -version
示例输出如下:
Version: ImageMagick 7.0.4-5 Q16 x86_64 2017-01-27 https://imagemagick.org.cn Copyright: © 1999-2017 ImageMagick Studio LLC License: https://imagemagick.org.cn/script/license.php Features: Cipher DPC HDRI OpenMP Delegates (built-in): x zlib
在这篇文章中,我们学习了如何在Ubuntu上安装ImageMagick,我们将继续提供更多基于Linux的技巧和提示。继续关注!
广告