Install ImageMagick 5.5.7 on Debian

16274 단어
ImageMagick 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 imagick pecl module). 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 imagemagickbut there is no package for version 5. So we have to install it from source. First download the source from imagemagick ftp: wget ftp://ftp.imagemagick.net/pub/ImageMagick/ImageMagick-5.5.7-36.tar.gzUncompress it somewhere, and you are now ready to compile it. This is no different than ./compile; make; make installthat 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: ./configurebut 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 this configuration matches your expectations. Host system type : x86_64-debian-linux-gnu Option Configure option Configured value ----------------------------------------------------------------- Shared libraries --enable-shared=yes yes Static libraries --enable-static=yes yes GNU ld --with-gnu-ld=yes yes LZW support --enable-lzw=yes yes Quantum depth --with-quantum-depth=16 16 Delegate Configuration: BZLIB --with-bzlib=yes yes DPS --with-dps=yes no EXIF --with-exif=yes yes FlashPIX --with-fpx=yes no FreeType 2.0 --with-ttf=yes yes Ghostscript 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 no JBIG --with-jbig=yes no JPEG v1 --with-jpeg=yes yes JPEG-2000 --with-jp2=yes yes LCMS --with-lcms=yes yes Magick++ --with-magick-plus-plus=no no PERL --with-perl=no no --with-png=yes yes TIFF --with-tiff=yes yes Windows fonts --with-windows-font-dir= none WMF --with-wmf=yes yes X11 --with-x= yes --with-xml=yes yes ZLIB --with-zlib=yes yes X11 Configuration: X_CFLAGS = -I/usr/include/X11 X_PRE_LIBS = -lSM -lICE X_LIBS = -L/usr/lib/X11 X_EXTRA_LIBS = Options used to compile and link: CC = gcc CFLAGS = -g -O2 -Wall CPPFLAGS = -I/usr/include/freetype2 -D_REENTRANT -I/usr/include/X11 -I/usr/include/libxml2 CXX = g++ CXXFLAGS = -g -O2 LDFLAGS = -L/usr/lib/X11 -lfreetype -lz -L/usr/lib LIBS = -llcms -ltiff -lfreetype -ljasper -ljpeg -lpng -lexif -lwmflite -lXext -lSM -lICE -lX11 -lbz2 -lxml2 -lz -lpthread -lmNow we can proceed with the actual compilation: makeand 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 rules png.c:7705: warning: dereferencing type-punned pointer will break strict-aliasing rules make[1]: *** [png.lo] Error 1 make[1]: Leaving directory `/usr/local/src/ImageMagick-5.5.7/coders' make: *** [all-recursive] Error 1This 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 -version Version: ImageMagick 5.5.7 12/21/06 Q16 http://www.imagemagick.org Copyright: Copyright (C) 2003 ImageMagick Studio LLCor /usr/local/bin/convert -version Version: ImageMagick 5.5.7 12/21/06 Q16 http://www.imagemagick.org Copyright: Copyright (C) 2003 ImageMagick Studio LLCand to get the listing of which image formats are supported on our system: identify -list format Format Mode Description ——————————————————————————- 8BIM* rw- Photoshop resource format 8BIMTEXT* rw- Photoshop resource text format 8BIMWTEXT* rw- Photoshop resource wide text format APP1* rw- Raw application information APP1JPEG* rw- Raw JPEG binary data ART* r– PFS: 1st Publisher Format originally used on the Macintosh (MacPaint?) and later used for PFS: 1st Publisher clip art. NOT the AOL ART format. AVI* r– Microsoft Audio/Visual Interleaved AVS* rw+ AVS X image BIE* — Joint Bi-level Image experts Group interchange format BMP* rw- Microsoft Windows bitmap image BMP2* -w- Microsoft Windows bitmap image v2 BMP3* -w- Microsoft Windows bitmap image v3 CACHE* — Magick Persistent Cache image format CAPTION* r– Image caption CMYK* rw+ Raw cyan, magenta, yellow, and black samples CMYKA* rw+ Raw cyan, magenta, yellow, black, and opacity samples CUR* r– Microsoft icon CUT* r– DR Halo DCM* r– Digital Imaging and Communications in Medicine image DICOM is used by the medical community for images like X-rays. The specification, “Digital Imaging and Communications in Medicine (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 Paintbrush DPS r– Display Postscript Interpreter DPX* rw+ Digital Moving Picture Exchange EPDF rw- Encapsulated Portable Document Format EPI* rw- Adobe Encapsulated PostScript Interchange format EPS* rw- Adobe Encapsulated PostScript EPS2* -w- Adobe Level II Encapsulated PostScript EPS3* -w+ Adobe Level III Encapsulated PostScript EPSF* rw- Adobe Encapsulated PostScript EPSI* rw- Adobe Encapsulated PostScript Interchange format EPT rw- Adobe Encapsulated PostScript with TIFF preview EXIF* rw- Exif digital camera binary data FAX* rw+ Group 3 FAX See TIFF format. Note that FAX machines use non-square pixels which are 1.5 times wider than they are tall but computer displays use square pixels, so FAX images may appear to be narrow unless they are explicitly resized using a resize specification of “150×100%”. FITS* rw- Flexible Image Transport System FPX* rw- FlashPix Format FRACTAL* r– Plasma fractal image G3* rw- Group 3 FAX GIF* rw+ CompuServe graphics interchange format GIF87* rw- CompuServe graphics interchange format (version 87a) GRADIENT* r– Gradual passing from one shade to another GRANITE* r– Granite texture GRAY* rw+ Raw gray samples HISTOGRAM* -w- Histogram of the image HTM* -w- Hypertext Markup Language and a client-side image map HTML(link)* -w- Hypertext Markup Language and a client-side image map ICB* rw+ Truevision Targa image ICC* rw- ICC Color Profile ICM* rw- ICC Color Profile ICO* r– Microsoft icon ICON* r– Microsoft icon IPTC* rw- IPTC Newsphoto IPTCTEXT* rw- IPTC Newsphoto text format IPTCWTEXT* rw- IPTC Newsphoto text format JBG* — Joint Bi-level Image experts Group interchange format JBIG* — Joint Bi-level Image experts Group interchange format JNG* rw- JPEG Network Graphics See http://www.libpng.org/pub/mng/ for details about the JNG format. The JNG 1.0 specification is available there and at ftp://swrinde.nde.swri.edu/pub/mng/documents/. JP2* rw- JPEG-2000 JP2 File Format Syntax JPC* rw- JPEG-2000 Code Stream Syntax JPEG* rw- Joint Photographic Experts Group JFIF format (62) JPG* rw- Joint Photographic Experts Group JFIF format LABEL* r– Image label LOGO* rw- ImageMagick Logo M2V rw+ MPEG Video Stream MAGICK* r– Predefined Magick Image MAP* rw- Colormap intensities and indices MAT* r– MATLAB image format MATTE* -w+ MATTE format MIFF* rw+ Magick Image File Format MNG* rw+ Multiple-image Network Graphics (libpng 1.2.8) See http://www.libpng.org/pub/mng/ for details about the MNG format. The MNG 1.0 specification is available there and at ftp://swrinde.nde.swri.edu/pub/mng/documents/. MONO* rw- Bi-level bitmap in least-significant-byte first order MPC* rw+ Magick Persistent Cache image format MPEG rw+ MPEG Video Stream MPG rw+ MPEG Video Stream MSL* rw+ Magick Scripting Language MTV* rw+ MTV Raytracing image format MVG* rw- Magick Vector Graphics NETSCAPE* r– Netscape 216 color cube NULL* rw- Constant image of uniform color OTB* rw- On-the-air bitmap P7* rw+ Xv thumbnail format PAL* rw- 16bit/pixel interleaved YUV PALM* rw- Palm pixmap PATTERN* r– Predefined pattern PBM* rw+ Portable bitmap format (black and white) PCD* rw- Photo CD PCDS* rw- Photo CD PCL* -w- Page Control Language PCT* rw- Apple Macintosh QuickDraw/PICT PCX* rw- ZSoft IBM PC Paintbrush PDB* rw+ Palm Database ImageViewer Format PDF rw+ Portable Document Format PFA* r– Postscript Type 1 font (ASCII) PFB* r– Postscript Type 1 font (binary) PGM* rw+ Portable graymap format (gray scale) PGX* r– JPEG-2000 VM Format PICON* rw- Personal Icon PICT* rw- Apple Macintosh QuickDraw/PICT PIX* r– Alias/Wavefront RLE image format PLASMA* r– Plasma fractal image PM* rw- X Windows system pixmap (color) * 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 at ftp://swrinde.nde.swri.edu/pub/png/documents/. PNG24* rw- 24-bit RGB , opaque only (zlib 1.2.3) PNG32* rw- 32-bit RGBA , semitransparency OK PNG8* rw- 8-bit indexed , binary transparency only PNM* rw+ Portable anymap PPM* rw+ Portable pixmap format (color) PREVIEW* -w- Show a preview an image enhancement, effect, or f/x PS* rw+ Adobe PostScript PS2* -w+ Adobe Level II PostScript PS3* -w+ Adobe Level III PostScript PSD* rw+ Adobe Photoshop bitmap PTIF* rw- Pyramid encoded TIFF PWP* r– Seattle Film Works RAS* rw+ SUN Rasterfile RGB* rw+ Raw red, green, and blue samples RGBA* rw+ Raw red, green, blue, and matte samples RLA* r– Alias/Wavefront image RLE* r– Utah Run length encoded image SCT* r– Scitex HandShake SFW* r– Seattle Film Works SGI* rw+ Irix RGB image SHTML* -w- Hypertext Markup Language and a client-side image map STEGANO* r– Steganographic image SUN* rw+ SUN Rasterfile SVG* rw+ Scalable Vector Gaphics ( 2.6.27) TEXT* rw+ Text TGA* rw+ Truevision Targa image TIF* rw+ Tagged Image File Format (42) TIFF* rw+ Tagged Image File Format (42) TILE* r– Tile image with a texture TIM* r– PSX TIM TTF* r– TrueType font TXT* rw+ Text UIL* -w- X-Motif UIL table UYVY* rw- 16bit/pixel interleaved YUV VDA* rw+ Truevision Targa image VICAR* rw- VICAR rasterfile format VID* rw+ Visual Image Directory VIFF* rw+ Khoros Visualization image VST* rw+ Truevision Targa image WBMP* rw- Wireless Bitmap (level 0) image WMF* r– Windows Meta File WPG* r– Word Perfect Graphics X* rw- X Image XBM* rw- X Windows system bitmap (black and white) XC* r– Constant image uniform color XCF* r– GIMP image XMP* rw- Adobe metadata XPM* rw- X Windows system pixmap (color) XV* rw+ Khoros Visualization image XWD* rw- X Windows system window dump (color) YUV* rw- CCIR 601 4:1:1 or 4:2:2 * native blob support

좋은 웹페이지 즐겨찾기