ImageMagick® is a software suite to create, edit, compose, or convert bitmap images. It can read and write images in a variety of formats (over 100) including DPX, EXR, GIF, JPEG, JPEG-2000, PDF, PNG, Postscript, SVG, and TIFF. Use ImageMagick to resize, flip, mirror, rotate, distort, shear and transform images, adjust image colors, apply various special effects, or draw text, lines, polygons, ellipses and Bézier curves.
ImageMagick can be installed by either using the remi repository, or by compiling the source code from the latest stable release. Following the installation guide is another guide on how to install the ImageMagick PHP extension (imagick).
Simple install from remi repository
If you have not installed the epel repository, install it now.
wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm rpm -Uvh epel-release-6*.rpm
Next, install the remi repository:
wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm rpm -Uvh remi-release-6*.rpm
An additional step is required to enable the remi repository:
Use your favorite text editor to open
/etc/yum.repos.d/remi.repo. Look for the remi section and find
enabled=0 and change it to
Make sure that the required dependencies are installed:
yum install -y gcc php-devel php-pear
Then install ImageMagick:
yum install -y ImageMagick ImageMagick-devel
Extra: If you plan on using ImageMagick in perl scripts:
yum install ImageMagick-perl
The installation is now complete.
Install from source code
First install dependencies:
yum -y groupinstall 'Development Tools' yum -y install bzip2-devel freetype-devel libjpeg-devel libpng-devel libtiff-devel giflib-devel zlib-devel ghostscript-devel djvulibre-devel libwmf-devel jasper-devel libtool-ltdl-devel libX11-devel libXext-devel libXt-devel lcms-devel libxml2-devel librsvg2-devel OpenEXR-devel php-devel
Now, fetch the source code:
wget http://www.imagemagick.org/download/ImageMagick.tar.gz tar xvzf ImageMagick.tar.gz cd ImageMagick*
Configure and compile the source code. Depending on your server specs, this may take some time to complete.
./configure make make install
Verify that the compile and install were successful:
Install PHP extension
imagick PHP extension module
pecl install imagick
You will be asked to provide the ImageMagick installation prefix. Press
[ENTER] to auto detect. You may get this error following the pecl command:
"Error shtool at '/var/tmp/imagick/build/shtool' does not exist or is not executable. Make sure that the file exists and is executable and then rerun this script"
This is due to a secured and mounted
/tmp directory. You may have setup your
/tmp folder in this way as part of your server security lock-down. To resolve this error temporarily, remove the
/tmp line in
/etc/fstab and reboot. Run the pecl command again. When installation completes, you can add the
/tmp line back to
/etc/fstab and reboot. Using the
umount command will not work if
/tmp has the
Next, add the
imagick.so extension to the
php.ini file. Start by locating your
php.ini file. It is usually found in
php -i | grep "Loaded Configuration File"
Use a text editor to open
php.ini and look for the dynamic extension section. Add
extension=imagick.so, then save.
Check the php extension list to verify that imagick has installed correctly:
php -m | grep imagick
If you are running a webserver, such as Apache, remember to restart it:
service httpd restart
- The official ImageMagick website.
Want to contribute?
You could earn up to $300 by adding new articles
Suggest an update
Request an article