ImageMagick is a free and open-source software . It can be used for displaying, converting, and editing raster image and vector image files. It can read and write over 200 image file formats including PNG, JPEG, JPEG-2000, GIF, TIFF and much more.
The ImageMagick version available in default repositories is often out of date. So to install the latest version of ImageMagick we will install it from source.
- The upside of installing ImageMagick from source is that you will have the latest version of ImageMagick available and not the outdated version.
- The downside of Installing ImageMagick from source is that you are responsible for keeping it up to date.
I am assuming here that you have already installed some version of php on your server. I am using PHP 5.6 on my server for this article. The procedure is similar for PHP 5 or PHP 7.
The steps involved in installing Latest ImageMagick in CentOS 7 with DirectAdmin are following:
Install the Dependencies for ImageMagick in CentOS 7.
First of all, we will be installing additional dependency packages which we will need later during the installation process.
Update your System before installing anything.
shell> yum update shell> yum groupinstall "Development Tools" shell> yum install ImageMagick ImageMagick-devel -y
since we have installed dependencies on our server, now we can compile ImageMagick from source.
Download the latest ImageMagick.
Download the Latest ImageMagick package from here. The steps in compiling ImagemMagick are as follows.
For CentOS 6.8 with Directadmin.
shell> wget http://pecl.php.net/get/imagick-3.4.3RC1.tgz shell> tar -zxf imagick-3.4.3RC1.tgz shell> cd imagick-3.4.3RC1 shell> /usr/local/php56/bin/phpize shell> ./configure --with-php-config=/usr/local/php56/bin/php-config shell> make shell> make install
To install latest ImageMagick in CentOS 7
shell> wget http://pecl.php.net/get/imagick-3.4.3RC1.tgz shell> tar -zxf imagick-3.4.3RC1.tgz shell> cd imagick-3.4.3RC1 shell> ./configure shell> make shell> make install
Also, we will add the ImageMagick Extension to our php.ini file.
Find the loaded php.ini file.
For PHP 5.5 or 5.6
shell> php -i | grep php.ini Loaded Configuration File => /etc/php.ini
For PHP 7
shell> php70 -i | grep php.ini Configuration File (php.ini) Path => /etc/opt/remi/php70 Loaded Configuration File => /etc/opt/remi/php70/php.ini
Since we know the location of php.ini being used by our server , now we can add the following line at the end our php.ini file.
Also, I am using PHP 5.6 in CentOS 7 with DirectAdmin web Panel. The location of php.ini in my server is /usr/local/php56/lib/php.ini. so i will edit this file.
shell> vi /usr/local/php56/lib/php.ini extension=imagick.so
Restart php-fpm process in CentOS 6.8.
shell> service php-fpm56 restart
For PHP 7.0 on CentOS 7
shell> systemctl restart php70-php-fpm.service
Finally, we have installed and configured the server with latest ImageMagick.
Verify the ImageMagick installation.
we can verify the installation of ImageMagick using the following commands.
php -i | grep Imagick
php -m | grep imagick
which identify && identify -list format
/usr/bin/identify -list configure
In conclusion, ImageMagick is a free software and a very useful one. You can use ImageMagick from the command line. Also, It can also be integrated with many popular languages such as PHP or Perl.
If you find this software useful then consider donating money to their hard working developers for their efforts. Your donation can also help in continuing this project. Here’s a link for donation.
Please share this article with your friends. Good day.