Table of Contents
Try Vultr Today with

$50 Free on Us!

Want to contribute?

You could earn up to $300 by adding new articles!

Install ImageMagick on CentOS 6

Last Updated: Tue, Oct 21, 2014
CentOS Linux Guides PHP

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.

rpm -Uvh epel-release-6*.rpm

Next, install the remi repository:

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 enabled=1.

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:

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.

make install

Verify that the compile and install were successful:

convert --version 

Install PHP extension

Install the 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 nosuid,noexec,nodev options.

Next, add the extension to the php.ini file. Start by locating your php.ini file. It is usually found in /etc.

php -i | grep "Loaded Configuration File"

Use a text editor to open php.ini and look for the dynamic extension section. Add, 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


  1. The official ImageMagick website.

Want to contribute?

You could earn up to $300 by adding new articles