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 --with-imagick=/usr/local
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(link), 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
Tags: imagick
Share This







20th January 2007, 10:37
Hi,
I would like to add a few words to your tutorial (for all newbies like me…) :
You need “php5-dev” package for using “phpize” commands…
I did not have the package installed on my computer and phpize command returned a bash error “command unavailable”
While I carried out research on phpize I found another way of making this installation more easily on a ubuntu linux computer :
sudo pecl install imagick-0.9.11
28th January 2007, 18:23
Thanks for you helpful addition!… I definitely had in mind the note about php5-dev package, but I have no idea how I missed it out in the end.
Thanks,
- Marius -
30th May 2007, 00:08
Gotta get Zimbra on the mailserver poll. Admittedly it’s Postifx in the curtains, but it really stands out…
Karsten
29th August 2007, 19:08
there is a php5-imagick package in the ubuntu repositories which is supposedly enables the same php5 extension, however for some reason that package did not work for me, i choose to install imagick using PECL which is more helpful in the future to stay up to date with newer releases, this is important since this is still in beta!
here’s a summery of what you need:
1st you need to have the pear and imagemagick packages of course.
you will also need to install “libmagick9-dev” package.
sudo apt-get install pear imagemagick libmagick9-dev
then simply:
sudo pear install -f PECL/Imagick
the “-f” will force the latest version, which is recommended to keep up to date.
you will be asked to provide the prefix of Imagemagick installation. leave this as “autodetect” and it should work fine.
it should automatically add “extension=imagick.so” to your php.ini
but in case it doesn’t do it yourself.
PS: don’t forget to restart apache to enable the new extension
hope this helps.
30th August 2007, 21:48
hi ahmed,
in your command:
sudo apt-get install pear imagemagick libmagick9-dev
is it pear or php-pear????
this command did not work me..I am using ubuntu 7.04.
could you help ???
thanks
prasad.
31st August 2007, 16:28
Prasad: if you are running php5 the package is called php-pear (if you are still using php4 the package you need is php4-pear).
21st May 2008, 08:04
Thanks for a great guide and comments about php5-dev. I have succesfully installed imagick but get an error when I try it out:
Uncaught exception ‘ImagickException’ with message ‘Can not process empty wand’
Anybody have a clue?
21st May 2008, 08:40
Pierre: probably your code is using newer features in imagick not available in your install. You might be better to ask this on the imagick maillists, and be sure to also include your installed versions.
ps. imagick-2.1.x is stable at this time and it is built on ImageMagick version 6.2.4+; this was not the case when I wrote this post ;-). If possible I would run v2.1.1 at this time. hth.