Tips / Nginx

How to install ImageMagick + PHP Imagick on CentOS

ImageMagick is an image development suite that allows you to create, manipulate or convert bitmap images. It supports many common image format such as: GIF, JPEG, JPEG-2000, PDF, PNG, SVG, TIFF, DPX, EXR, among many others. ImageMagick is very used to rotate, mirror, resize, draw, apply many more special effects to your images.


You can use ImageMagick from the command line, but it also supports integration with many popular languages such as PHP, Perl or C++. Today we will take a look about how to install ImageMagick and Imagick PHP library on CentOS Linux.

Tutorial Requirements

Ensure you have php-pear installed, which will be used later to install Imagick PHP module.
If you don’t have pear, you can install using Yum:

yum install php-pear

Install ImageMagick

yum install ImageMagick*

Install Imagick, the ImageMagick PHP library

pecl install Imagick

The output shoudl look like this:

[]pecl install Imagick
downloading imagick-3.1.2.tgz ...
Starting to download imagick-3.1.2.tgz (94,657 bytes)
.....................done: 94,657 bytes
15 source files, building
running: phpize
Configuring for:
PHP Api Version: 20100412
Zend Module Api No: 20100525
Zend Extension Api No: 220100525
Please provide the prefix of Imagemagick installation [autodetect] :
building in /root/tmp/pear/pear-build-rootJJlLyo/imagick-3.1.2
running: /root/tmp/pear/imagick/configure --with-imagick

Check if Imagick was installed ok:

php -i | grep Imagick

You should see this output while running:

[]php -i | grep Imagick -i
imagick module => enabled
imagick module version => 3.1.2
imagick classes => Imagick, ImagickDraw, ImagickPixel, ImagickPixelIterator
imagick.locale_fix => 0 => 0
imagick.progress_monitor => 0 => 0

Popular search terms:

  • centos php imagick
  • https://www scalescale com/tips/nginx/install-imagemagick-php-imagick-centos/
  • centos install top command
  • centos imagick

Esteban Borges

Linux Geek, Webperf Addict, Nginx Fan. CTO @Infranetworking

  • And if you installed ImageMagick & PHP Imagick successfully, you can benefit immediately. If you’re working with WordPress you’ll see an improvement: better image quality, EXIF details preserved and ICC profiles embedded (you only have to regenerate the thumbnails in WordPress, there’s a plugin for it).
    Now you’ve installed ImageMagick, it’s time to bring the quality of your images to the next level by giving them the optimal sharpness. I wrote a WordPRess plugin for it which uses ImageMagick & PHP Imagick. On you can read everything you need.