Install ImageMagick (Image Manipulation) Tool on RHEL/CentOS and Fedora

ImageMagick is a free open source simple software suite for any kind of image manipulation that is used for creating, editing, converting, displaying image files.

It can able to read and write over 200 image files such as JPEG, GIF, PNG, TIFF, and Photo CD image formats and it is also used for thumbnail or captcha generation. It also includes command-line options for creating transparent or animated gif image formats and many more features like resize, sharpen, rotate or add special effects to an image.

To use the ImageMagick tool with PHP or Perl programming language, you will need to install ImageMagick with the Imagick PHP extension for PHP and ImageMagick-Perl extension for Perl.

Imagick is a simple PHP extension for creating and modifying images using the ImageMagick API program. There is a confusion in name, as people think that ImageMagick and Imagick both are the same, but you can use ImageMagick without Imagick extension but you need both installed on your machine to use and run it.

Installing ImageMagick from Repository

First, install following prerequisite php-pear, php-devel and gcc packages to compile the Imagick PHP extension.

# yum install php-pear php-devel gcc 
Install PHP Extensions in CentOS 8
Install PHP Extensions in CentOS 8

Once you’ve installed php-pear, php-devel, and gcc packages, you may now install ImageMagick software for PHP and Perl support using yum command.

# yum install ImageMagick ImageMagick-devel ImageMagick-perl

IMPORTANT: ImageMagick is not available in CentOS/RHEL 8, and it has been replaced with GraphicsMagick instead, which is a fork of ImageMagick.

To install GraphicsMagick on CentOS/RHEL 8, run the following command.

# dnf info GraphicsMagick
# dnf install GraphicsMagick GraphicsMagick-devel GraphicsMagick-perl
Install GraphicsMagick in CentOS 8
Install GraphicsMagick in CentOS 8

Next, verify that ImageMagick has been installed on your system by checking its version.

# convert --version
Version: ImageMagick 6.7.8-9 2019-02-01 Q16
Copyright: Copyright (C) 1999-2012 ImageMagick Studio LLC
Features: OpenMP    

CentOS/RHEL 8 users, can run the following command to verify the version of GraphicsMagick installed on the system.

# gm version

GraphicsMagick 1.3.33 2019-07-20 Q16
Copyright (C) 2002-2019 GraphicsMagick Group.
Additional copyrights and licenses apply to this software.
See for details.

Installing ImageMagick 7 from Source Code

To install ImageMagick from source, you need a proper development environment with a compiler and related development tools. If you don’t have the required packages on your system, install development tools as shown:

# yum 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, download the latest version of the ImageMagick source code using the following wget command and extract it.

# wget
# tar xvzf ImageMagick.tar.gz

Configure and compile the ImageMagick source code. Depending on your server hardware specs, this may take some time to finish.

# cd ImageMagick*
# ./configure
# make
# make install

Verify that the ImageMagick compile and install were successful.

# magick -version

Version: ImageMagick 7.0.8-28 Q16 x86_64 2019-02-19
Copyright: © 1999-2019 ImageMagick Studio LLC
Features: Cipher DPC HDRI OpenMP 
Delegates (built-in): bzlib djvu fontconfig freetype jng jpeg lzma openexr pangocairo png tiff wmf x xml zlib

Install Imagick PHP Extension

Next, compile the Imagick for PHP extension. To do, simply run the following ‘pecl‘ command. It will install ImageMagick and imagick PHP extension module ‘‘ under /usr/lib/php/modules directory. If you are using a 64-bit system, the module directory path would be /usr/lib64/php/modules.

Note: It will ask you to provide Imagemagick installation prefix, simply hit enter to auto-detect.

# pecl install imagick 

downloading imagick-3.4.3.tgz ...
Starting to download imagick-3.4.3.tgz (245,410 bytes)
...................................................done: 245,410 bytes
19 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] : 

Now, add the ‘‘ extension to ‘/etc/php.ini‘ file.

echo >> /etc/php.ini

Next, restart Apache webserver.

# service httpd restart

Verify the Imagick PHP extension by running the following command. You will see the Imagick extension similar to below.

# php -m | grep imagick


Install GMagick PHP Extension

Run the following commands to compile and install GMagick PHP Extension.

# cd /usr/local/src
# wget
# tar xfvz gmagick
# cd gmagick-*
# phpize
# ./configure
# make
# make install

Now, add the ‘‘ extension to ‘/etc/php.ini‘ file.

# echo >> /etc/php.ini

Next, restart the Apache webserver.

# systemctl restart httpd

Verify gmagick PHP extension by running the following command.

# php -m | grep gmagick


Alternatively, you can create a file called ‘phpinfo.php‘ under website root directory (ex: /var/www/html/).

# vi /var/www/html/phpinfo.php

Add the following code.


     phpinfo ();

Open your favorite web browser and type ‘http://localhost/phpinfo.php‘ or ‘http://ip-addresss/phpinfo.php‘ and verify the extension.

Check Imagick Version
Check Imagick Version
Verify Gmagick PHP Extension
Verify Gmagick PHP Extension
If you liked this article, then do subscribe to email alerts for Linux tutorials. If you have any questions or doubts? do ask for help in the comments section.

If You Appreciate What We Do Here On TecMint, You Should Consider:

TecMint is the fastest growing and most trusted community site for any kind of Linux Articles, Guides and Books on the web. Millions of people visit TecMint! to search or browse the thousands of published articles available FREELY to all.

If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.

Support Us

We are thankful for your never ending support.

41 thoughts on “Install ImageMagick (Image Manipulation) Tool on RHEL/CentOS and Fedora”

  1. I was able to install ImageMagick on CentOS 7. I ran convert --version and the following was returned:

    # convert --version
    Version: ImageMagick 6.9.10-68 Q16 x86_64 2020-04-01
    Copyright: © 1999-2019 ImageMagick Studio LLC
    Features: Cipher DPC Modules OpenMP(3.1)
    Delegates (built-in): bzlib cairo fontconfig freetype gslib 
    jng jpeg lcms ltdl lzma openexr pangocairo png ps rsvg tiff wmf x xml zlib

    So I don’t think ImageMagick was discontinued for CentOS 7

  2. I am supposed to use ImageMagick in the Alfresco DMS solution. But since I am setting Alfresco in centos 8.1 and as mentioned by you, that ImageMagick in not supported in version 8, I installed GraphicsMagick. I did not build from source rather used command:

    # dnf install GraphicsMagick

    My questions are:

    1. What is the root installation directory of GraphicsMagick?

    2. I need to set the following parameters in my alfresco. What would be corresponding values for GraphicsMagick software

    Property 	Description
    img.root 	On Windows, set this property to img.root=C:\\ImageMagick
                            On Linux, set this property to img.root=/ImageMagick
    img.dyn 	On Windows, set this property to img.dyn=${img.root}\\lib
                            On Linux, set this property to img.dyn=${img.root}/lib
    img.exe 	On Windows, set this property to img.exe=${img.root}\\convert.exe
                            On Linux, set this property to img.exe=${img.root}/bin/convert
    img.coders 	On Windows, set this property to img.coders=${img.root}\\modules\\coders
                            On Linux, set this property to img.coders=${img.root}/modules/coders
    img.config 	On Windows, set this property to img.config=${img.root}\\config
                            On Linux, set this property to img.config=${img.root}/config
    img.url 	        On Windows, set this property to img.url=${img.root}\\url
                            On Linux, set this property to img.url=${img.root}/url
  3. This works for me on CentOS 7.7.1908, you replace rh-php71-php-XXXXXX which should install other similar library/modules.
    sudo yum install rh-php71-php-imagick -y && systemctl restart rh-php71-php-fpm.service

  4. I get to this step, “Install Imagick PHP Extension“, but get this error back from Terminal:

    "bash: pecl: command not found".  

    I am using this command: “pecl install imagick“.

    Did I miss a step, or am I running the wrong command?


Got something to say? Join the discussion.

Have a question or suggestion? Please leave a comment to start the discussion. Please keep in mind that all comments are moderated and your email address will NOT be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.