imagick php module build using ImageMagick 5

imagick is a native php-extension that provides a wrapper to the ImageMagick / GraphicsMagick library. You need the ImageMagick libraries from www.imagemagick.org or GraphicsMagick libraries from www.graphicsmagick.org to get it running. ImageMagick 6 support is EXPERIMENTAL.

Note: I am aware of another php module implementing Imagemagick functions (MagickWand for PHP from imagemagick developers) but for my project this was not a solution and I just needed a functional version of imagick module running on top of Debian Etch (with apache 2.2.3 and php 5.2).

The reason for my previous post “Install ImageMagick 5.5.7 on Debian” was to prepare the installation of the imagick php module, so once we have installed ImageMagick 5 from source we can proceed with the php module installation. The actual installation is very simple and anyone that has previously installed php extensions will see no difference (the only special thing was to build it against the ImageMagick 5 we installed previously).

Download the source of imagick from pecl:

wget http://pecl.php.net/get/imagick-0.9.11.tgz

(the latest version is 0.9.11 and this was released more than 2 years ago).

Uncompress it:

tar -xvvzf imagick-0.9.11.tgz

Compile it as any php extension (the only special thing is to specify the location we installed ImageMagick on the configure):

cd imagick-0.9.11
phpize
./configure <strong>--with-imagick=/usr/local</strong>
make
make install

Optionally we can strip the resulted binary (adjust the location of the installed module if needed - based on the php version you are using):

strip /usr/lib/php5/20060613/imagick.so

The only thing left is to enable the imagick php module. For this just add:

extension=imagick.so

to your php.ini file.

Once you have reloaded the web service (for ex: /etc/init.d/apache2 reload), you can check that the newly installed php module appears (for ex. using a phpinfo call). This will appear like:

imagick
ImageMagick support => enabled
Magick Backend => ImageMagick
ImageMagick version => 5.5.7
PHP imagick version => 0.9.11
MaxRGB => 65535
Supported image formats => 8BIM, 8BIMTEXT, 8BIMWTEXT, APP1, APP1JPEG, ART, AVI, AVS, B, BIE, BMP, BMP2, BMP3, C, CACHE, CAPTION, CMYK, CMYKA, CUR, CUT, DCM, DCX, DIB, DPS, DPX, EPDF, EPI, EPS, EPS2, EPS3, EPSF, EPSI, EPT, EXIF, FAX, FILE, FITS, FPX, FRACTAL, FTP, G, G3, GIF, GIF87, GRADIENT, GRANITE, GRAY, H, HISTOGRAM, HTM, HTML, HTTP, ICB, ICC, ICM, ICO, ICON, IMPLICIT, IPTC, IPTCTEXT, IPTCWTEXT, JBG, JBIG, JNG, JP2, JPC, JPEG, JPG, K, LA, BEL, LOGO, M, M2V, MAGICK, MAP, MAT, MATTE, MIFF, MNG, MONO, MPC, MPEG, MPG, MPR, MPRI, MSL, MTV, MVG, NETSCAPE, NULL, O, OTB, P7, PAL, PALM, PATTERN, PBM, PCD, PCDS, PCL, PCT, PCX, PDB, PDF, PFA, PFB, PGM, PGX, PICON, PICT, PIX, PLASMA, PM, PNG, PNG24, PNG32, PNG8, PNM, PPM, PREVIEW, PS, PS2, PS3, PSD, PTIF, PWP, R, RAS, RGB, RGBA, RLA, RLE, ROSE, SCT, SFW, SGI, SHTML, STEGANO, SUN, SVG, TEXT, TGA, TIF, TIFF, TILE, TIM, TTF, TXT, UIL, UYVY, VDA, VICAR, VID, VIFF, VST, WBMP, WMF, WPG, X, XBM, XC, XCF, XMP, XPM, XV, XWD, Y, YUV
Font Family - Name => AvantGarde - AvantGarde-Book
Font Family - Name => AvantGarde - AvantGarde-BookOblique
Font Family - Name => AvantGarde - AvantGarde-Demi
Font Family - Name => AvantGarde - AvantGarde-DemiOblique
Font Family - Name => Bookman - Bookman-Demi
Font Family - Name => Bookman - Bookman-DemiItalic
Font Family - Name => Bookman - Bookman-Light
Font Family - Name => Bookman - Bookman-LightItalic
Font Family - Name => Courier - Courier
Font Family - Name => Courier - Courier-Bold
Font Family - Name => Courier - Courier-Oblique
Font Family - Name => Courier - Courier-BoldOblique
Font Family - Name => Helvetica - Helvetica
Font Family - Name => Helvetica - Helvetica-Bold
Font Family - Name => Helvetica - Helvetica-Oblique
Font Family - Name => Helvetica - Helvetica-BoldOblique
Font Family - Name => Helvetica Narrow - Helvetica-Narrow
Font Family - Name => Helvetica Narrow - Helvetica-Narrow-Oblique
Font Family - Name => Helvetica Narrow - Helvetica-Narrow-Bold
Font Family - Name => Helvetica Narrow - Helvetica-Narrow-BoldOblique
Font Family - Name => NewCenturySchlbk - NewCenturySchlbk-Roman
Font Family - Name => NewCenturySchlbk - NewCenturySchlbk-Italic
Font Family - Name => NewCenturySchlbk - NewCenturySchlbk-Bold
Font Family - Name => NewCenturySchlbk - NewCenturySchlbk-BoldItalic
Font Family - Name => Palatino - Palatino-Roman
Font Family - Name => Palatino - Palatino-Italic
Font Family - Name => Palatino - Palatino-Bold
Font Family - Name => Palatino - Palatino-BoldItalic
Font Family - Name => Times - Times-Roman
Font Family - Name => Times - Times-Bold
Font Family - Name => Times - Times-Italic
Font Family - Name => Times - Times-BoldItalic
Font Family - Name => Symbol - Symbol

As a comparison using the same imagick module but compiled against imagemagick 6 (or even simpler using the imagick module available on debian: apt-get install php5-imagick) we see an phpinfo output like:

imagick
ImageMagick support => enabled
Magick Backend => ImageMagick
ImageMagick version => 6.2.4
PHP imagick version => 0.9.11
MaxRGB => 65535
Supported image formats => 8BIM
Font Family - Name => AvantGarde - AvantGarde-Book
comments powered by Disqus