博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Install ImageMagick 5.5.7 on Debian
阅读量:2338 次
发布时间:2019-05-10

本文共 14151 字,大约阅读时间需要 47 分钟。

is a set of programs to manipulate various image formats (JPEG, TIFF, PhotoCD, PBM, XPM, etc…). All manipulations can be achieved through shell commands as well as through an X11 graphical interface. Possible effects: colormap manipulation, channel operations, thumbnail creation, image annotation, limited drawing, image distortion, etc…

Normally with any software I will try to use the latest available version because: the application should be better in newer versions, should be maintained more actively for security issues compared to legacy versions, etc.

Still in this case, I had to install several times an older version of ImageMagick. Why? Not for the application itself, but because of some applications that relied on the php wrapper (the ). This compiles fine with ImageMagick 6, but many functions fail. So in order to have the php module working properly I had to first install imagemagick 5 that is the last version the php module works fine.

I will show how to install ImageMagick 5.5.7 (the latest version available from the 5 branch) from sources on a Debian Etch system. Debian obviously contains packages for ImageMagick (v. 6.2.4 at the time of writing this post), that can be installed as easy as

apt-get install imagemagick

but there is no package for version 5. So we have to install it from source. First download the source from :

wget ftp://ftp.imagemagick.net/pub/ImageMagick/ImageMagick-5.5.7-36.tar.gz

Uncompress it somewhere, and you are now ready to compile it. This is no different than

./compile; make; make install

that any Linux user is familiar with. But the tricky part is to install the required packages for the compile to be successful and to use most of the functionalities that we need.

On our Debian system we can install all the required packages to compile the imagemagick debian package:

apt-get build-dep imagemagick

(just make sure you have a deb-src line in your sources.list). Depending from the state of the system and what packages is has already installed the result of this command will be different. For example on a stripped down Debian Etch system it looks like this:

apt-get build-dep imagemagick

Reading package lists… Done
Building dependency tree… Done
The following NEW packages will be installed
binutils build-essential cpp cpp-4.1 debhelper defoma dpkg-dev fontconfig-config g++ g++-4.1 gcc gcc-4.1 gettext graphviz gs-common gs-gpl gsfonts html2text intltool-debian libbz2-dev libc6-dev libexif-dev libexif12 libexpat1 libexpat1-dev libfontconfig1 libfreetype6 libfreetype6-dev libice-dev libice6 libjasper-1.701-1 libjasper-1.701-dev libjpeg62 libjpeg62-dev liblcms1 liblcms1-dev libltdl3 libltdl3-dev libpaper1 libperl5.8 libpng12-0 libpng12-dev libsm-dev libsm6 libssp0 libstdc++6-4.1-dev libtiff4 libtiff4-dev libtiffxx0c2 libwmf-dev libwmf0.2-7 libx11-6 libx11-data libx11-dev libxau-dev libxau6 libxaw7 libxdmcp-dev libxdmcp6 libxext-dev libxext6 libxml2 libxml2-dev libxmu6 libxpm4 libxt6 linux-kernel-headers make patch po-debconf tcl8.4 tk8.4 ttf-dejavu ucf x11-common x11proto-core-dev x11proto-input-dev x11proto-kb-dev x11proto-xext-dev xtrans-dev zlib1g-dev
0 upgraded, 81 newly installed, 0 to remove and 0 not upgraded.
Need to get 46.6MB/46.6MB of archives.
After unpacking 148MB of additional disk space will be used.

Now we have all what we need to compile imagemagick from source. Use configure with the options you need. For example, for default options you would use just:

./configure

but you might need some special parameters (check the installation docs for details on all the configurations available parameters)… for ex.:

./configure --with-perl=no --with-magick-plus-plus=no --enable-shared --with-gs-font-dir=/usr/share/fonts/type1/gsfonts --x-includes=/usr/include/X11 --x-libraries=/usr/lib/X11

After the configure script finishes verify the result and see if all looks as expected. The output in my case looks like:

ImageMagick is configured as follows. Please verify that thisconfiguration matches your expectations.Host system type : x86_64-debian-linux-gnuOption            Configure option              Configured value-----------------------------------------------------------------Shared libraries  --enable-shared=yes           yesStatic libraries  --enable-static=yes           yesGNU ld            --with-gnu-ld=yes             yesLZW support       --enable-lzw=yes              yesQuantum depth     --with-quantum-depth=16       16Delegate Configuration:BZLIB             --with-bzlib=yes              yesDPS               --with-dps=yes                noEXIF              --with-exif=yes               yesFlashPIX          --with-fpx=yes                noFreeType 2.0      --with-ttf=yes                yesGhostscript       None                          /usr/bin/gs (unknown)Ghostscript fonts --with-gs-font-dir=/usr/share/fonts/type1/gsfonts/usr/share/fonts/type1/gsfonts/Ghostscript lib   --with-gslib=no               noJBIG              --with-jbig=yes               noJPEG v1           --with-jpeg=yes               yesJPEG-2000         --with-jp2=yes                yesLCMS              --with-lcms=yes               yesMagick++          --with-magick-plus-plus=no    noPERL              --with-perl=no                no               --with-png=yes                yesTIFF              --with-tiff=yes               yesWindows fonts     --with-windows-font-dir=      noneWMF               --with-wmf=yes                yesX11               --with-x=                     yes               --with-xml=yes                yesZLIB              --with-zlib=yes               yesX11 Configuration:X_CFLAGS     = -I/usr/include/X11X_PRE_LIBS   = -lSM -lICEX_LIBS       = -L/usr/lib/X11X_EXTRA_LIBS =Options used to compile and link:CC       = gccCFLAGS   = -g -O2 -WallCPPFLAGS = -I/usr/include/freetype2 -D_REENTRANT -I/usr/include/X11-I/usr/include/libxml2CXX      = g++CXXFLAGS = -g -O2LDFLAGS  = -L/usr/lib/X11 -lfreetype -lz -L/usr/libLIBS     = -llcms -ltiff -lfreetype -ljasper -ljpeg -lpng -lexif -lwmflite-lXext -lSM -lICE -lX11 -lbz2 -lxml2 -lz -lpthread -lm

Now we can proceed with the actual compilation:

make

and if there are no errors with the installation:

make install

(this will install the files under /usr/local, since we have not overwritten the default –prefix).

As a reminder that older software might not compile on newer and modern OS’s (compilers, libraries, etc) the compilation fails on recent Debian Etch versions with:

png.c: In function 'WriteOneJNGImage':png.c:7639: warning: dereferencing type-punned pointer will break strict-aliasing rulespng.c:7705: warning: dereferencing type-punned pointer will break strict-aliasing rulesmake[1]: *** [png.lo] Error 1make[1]: Leaving directory `/usr/local/src/ImageMagick-5.5.7/coders'make: *** [all-recursive] Error 1

This is caused by newer versions of libpng12, and in order to compile imagemagick successfully I had to install version 1.2.8rel-7 (opposed to the latest version that is currently installed on etch 1.2.13-4)

Once the installation is completed we can verify the version we installed is working fine with:

/usr/local/bin/identify -versionVersion: ImageMagick 5.5.7 12/21/06 Q16 http://www.imagemagick.orgCopyright: Copyright (C) 2003 ImageMagick Studio LLC

or

/usr/local/bin/convert -versionVersion: ImageMagick 5.5.7 12/21/06 Q16 http://www.imagemagick.orgCopyright: Copyright (C) 2003 ImageMagick Studio LLC

and to get the listing of which image formats are supported on our system:

identify -list formatFormat  Mode  Description——————————————————————————-8BIM*  rw-  Photoshop resource format8BIMTEXT*  rw-  Photoshop resource text format8BIMWTEXT*  rw-  Photoshop resource wide text formatAPP1*  rw-  Raw application informationAPP1JPEG*  rw-  Raw JPEG binary dataART*  r–  PFS: 1st PublisherFormat originally used on the Macintosh (MacPaint?) and laterused for PFS: 1st Publisher clip art.  NOT the AOL ART format.AVI*  r–  Microsoft Audio/Visual InterleavedAVS*  rw+  AVS X imageBIE*  —  Joint Bi-level Image experts Group interchange formatBMP*  rw-  Microsoft Windows bitmap imageBMP2*  -w-  Microsoft Windows bitmap image v2BMP3*  -w-  Microsoft Windows bitmap image v3CACHE*  —  Magick Persistent Cache image formatCAPTION*  r–  Image captionCMYK*  rw+  Raw cyan, magenta, yellow, and black samplesCMYKA*  rw+  Raw cyan, magenta, yellow, black, and opacity samplesCUR*  r–  Microsoft iconCUT*  r–  DR HaloDCM*  r–  Digital Imaging and Communications in Medicine imageDICOM is used by the medical community for images like X-rays.The specification, “Digital Imaging and Communications inMedicine (DICOM)”, is available at http://medical.nema.org/In particular, see part 5 which describes the image encoding (RLE,JPEG, JPEG-LS), and supplement 61 which adds JPEG-2000 encoding.DCX*  rw+  ZSoft IBM PC multi-page PaintbrushDPS   r–  Display Postscript InterpreterDPX*  rw+  Digital Moving Picture ExchangeEPDF   rw-  Encapsulated Portable Document FormatEPI*  rw-  Adobe Encapsulated PostScript Interchange formatEPS*  rw-  Adobe Encapsulated PostScriptEPS2*  -w-  Adobe Level II Encapsulated PostScriptEPS3*  -w+  Adobe Level III Encapsulated PostScriptEPSF*  rw-  Adobe Encapsulated PostScriptEPSI*  rw-  Adobe Encapsulated PostScript Interchange formatEPT   rw-  Adobe Encapsulated PostScript with TIFF previewEXIF*  rw-  Exif digital camera binary dataFAX*  rw+  Group 3 FAXSee TIFF format.  Note that FAX machines use non-square pixelswhich are 1.5 times wider than they are tall but computer displaysuse square pixels, so FAX images may appear to be narrow unlessthey are explicitly resized using a resize specification of“150×100%”.FITS*  rw-  Flexible Image Transport SystemFPX*  rw-  FlashPix FormatFRACTAL*  r–  Plasma fractal imageG3*  rw-  Group 3 FAXGIF*  rw+  CompuServe graphics interchange formatGIF87*  rw-  CompuServe graphics interchange format (version 87a)GRADIENT*  r–  Gradual passing from one shade to anotherGRANITE*  r–  Granite textureGRAY*  rw+  Raw gray samplesHISTOGRAM*  -w-  Histogram of the imageHTM*  -w-  Hypertext Markup Language and a client-side image map)*  -w-  Hypertext Markup Language and a client-side image mapICB*  rw+  Truevision Targa imageICC*  rw-  ICC Color ProfileICM*  rw-  ICC Color ProfileICO*  r–  Microsoft iconICON*  r–  Microsoft iconIPTC*  rw-  IPTC NewsphotoIPTCTEXT*  rw-  IPTC Newsphoto text formatIPTCWTEXT*  rw-  IPTC Newsphoto text formatJBG*  —  Joint Bi-level Image experts Group interchange formatJBIG*  —  Joint Bi-level Image experts Group interchange formatJNG*  rw-  JPEG Network GraphicsSee http://www.libpng.org/pub/mng/ for details about the JNGformat. The JNG 1.0 specification is available there and atftp://swrinde.nde.swri.edu/pub/mng/documents/.JP2*  rw-  JPEG-2000 JP2 File Format SyntaxJPC*  rw-  JPEG-2000 Code Stream SyntaxJPEG*  rw-  Joint Photographic Experts Group JFIF format (62)JPG*  rw-  Joint Photographic Experts Group JFIF formatLABEL*  r–  Image labelLOGO*  rw-  ImageMagick LogoM2V   rw+  MPEG Video StreamMAGICK*  r–  Predefined Magick ImageMAP*  rw-  Colormap intensities and indicesMAT*  r–  MATLAB image formatMATTE*  -w+  MATTE formatMIFF*  rw+  Magick Image File FormatMNG*  rw+  Multiple-image Network Graphics (libpng 1.2.8)See http://www.libpng.org/pub/mng/ for details about the MNGformat. The MNG 1.0 specification is available there and atftp://swrinde.nde.swri.edu/pub/mng/documents/.MONO*  rw-  Bi-level bitmap in least-significant-byte first orderMPC*  rw+  Magick Persistent Cache image formatMPEG   rw+  MPEG Video StreamMPG   rw+  MPEG Video StreamMSL*  rw+  Magick Scripting LanguageMTV*  rw+  MTV Raytracing image formatMVG*  rw-  Magick Vector GraphicsNETSCAPE*  r–  Netscape 216 color cubeNULL*  rw-  Constant image of uniform colorOTB*  rw-  On-the-air bitmapP7*  rw+  Xv thumbnail formatPAL*  rw-  16bit/pixel interleaved YUVPALM*  rw-  Palm pixmapPATTERN*  r–  Predefined patternPBM*  rw+  Portable bitmap format (black and white)PCD*  rw-  Photo CDPCDS*  rw-  Photo CDPCL*  -w-  Page Control LanguagePCT*  rw-  Apple Macintosh QuickDraw/PICTPCX*  rw-  ZSoft IBM PC PaintbrushPDB*  rw+  Palm Database ImageViewer Format*  rw-  Portable Network Graphics (libpng 1.2.8)See http://www.libpng.org/ for details about the  format.The  1.2 specification is available there and atftp://swrinde.nde.swri.edu/pub/png/documents/.PNG24*  rw-  24-bit RGB , opaque only (zlib 1.2.3)PNG32*  rw-  32-bit RGBA , semitransparency OKPNG8*  rw-  8-bit indexed , binary transparency onlyPNM*  rw+  Portable anymapPPM*  rw+  Portable pixmap format (color)PREVIEW*  -w-  Show a preview an image enhancement, effect, or f/xPS*  rw+  Adobe PostScriptPS2*  -w+  Adobe Level II PostScriptPS3*  -w+  Adobe Level III PostScriptPSD*  rw+  Adobe Photoshop bitmapPTIF*  rw-  Pyramid encoded TIFFPWP*  r–  Seattle Film WorksRAS*  rw+  SUN RasterfileRGB*  rw+  Raw red, green, and blue samplesRGBA*  rw+  Raw red, green, blue, and matte samplesRLA*  r–  Alias/Wavefront imageRLE*  r–  Utah Run length encoded imageSCT*  r–  Scitex HandShakeSFW*  r–  Seattle Film WorksSGI*  rw+  Irix RGB imageSHTML*  -w-  Hypertext Markup Language and a client-side image mapSTEGANO*  r–  Steganographic imageSUN*  rw+  SUN RasterfileSVG*  rw+  Scalable Vector Gaphics ( 2.6.27)TEXT*  rw+  TextTGA*  rw+  Truevision Targa imageTIF*  rw+  Tagged Image File Format (42)TIFF*  rw+  Tagged Image File Format (42)TILE*  r–  Tile image with a textureTIM*  r–  PSX TIMTTF*  r–  TrueType fontTXT*  rw+  TextUIL*  -w-  X-Motif UIL tableUYVY*  rw-  16bit/pixel interleaved YUVVDA*  rw+  Truevision Targa imageVICAR*  rw-  VICAR rasterfile formatVID*  rw+  Visual Image DirectoryVIFF*  rw+  Khoros Visualization imageVST*  rw+  Truevision Targa imageWBMP*  rw-  Wireless Bitmap (level 0) imageWMF*  r–  Windows Meta FileWPG*  r–  Word Perfect GraphicsX*  rw-  X ImageXBM*  rw-  X Windows system bitmap (black and white)XC*  r–  Constant image uniform colorXCF*  r–  GIMP imageXMP*  rw-  Adobe  metadataXPM*  rw-  X Windows system pixmap (color)XV*  rw+  Khoros Visualization imageXWD*  rw-  X Windows system window dump (color)YUV*  rw-  CCIR 601 4:1:1 or 4:2:2* native blob support 

转载地址:http://xdepb.baihongyu.com/

你可能感兴趣的文章
Python3内置模块之玩出花儿的random随机方法小结
查看>>
Python基础教程学习:深入 Python iter() 方法
查看>>
Python基础学习教程专讲:Python爬虫抓取技术的门道
查看>>
Python基础教程学习:遇到需要的登录的网站怎么办?学好python,用这3招轻松搞定
查看>>
Python基础学习教程:觉得 Python 太“简单了”,这些题你又能答对几个?
查看>>
Python学习教程:程序员的技能树,决定了一生职业的高度
查看>>
“我自学Python学习教程,如何拿下了月薪15k的工作”
查看>>
聊个天对方老是撤回消息,学完这三步Python学习教程,撤回100条我也能看到!
查看>>
Python基础学习教程:Python玩转PDF各种骚操作大全
查看>>
发展最快的编程语言:Python的前景
查看>>
Python学习教程:Python这些位运算的妙用,绝对让你大开眼界
查看>>
Python面试经验总结,面试一时爽,一直面试一直爽!
查看>>
Python爬虫学习:听说你好不容易写了个爬虫,结果没抓几个就被封了?
查看>>
Python基础教程学习:听说你在学Python?来点PEP吧
查看>>
Python基础学习教程:我有故事你有酒吗?除了敲代码,程序员(媛)还能有什么副业?
查看>>
python爬虫教程:爬虫时如何知道是否代理ip伪装成功
查看>>
Python入门学习:又改需求了?可是程序写了一半了,不妨先捋捋我们的定位问题
查看>>
Python面试题目通关指南及独家建议,确定不瞅瞅?
查看>>
爬虫界又出神器|一款比selenium更高效的利器
查看>>
爬虫大家最关心的16个问题,7分钟的Python爬虫解疑大全教入门
查看>>