• Categories
    Category
    {{ postCtrl.tags }}
    • {{ category.tag_type }}

      • {{tag.tag_name}}
      • View more
  • Categories
    Category
    {{ postCtrl.tags }}
    • {{ category.tag_type }}

      • {{tag.tag_name}}
      • View more
  • News
  • Tutorials
  • Forums
  • Tags
  • Users
Tutorial News Comments FAQ Related Articles

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

{{postValue.id}}


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

ImageMagick is a simple open source software suited for any image manipulation, which is used for editing, converting, creating, displaying image files. It can read and also write many image files like JPEG, GIF, PNG, TIFF and Photo CD image formats. It can be used for thumbnail and captcha creation. ImageMagick includes command line options for generating transparent and animated gif image formats and also features like sharpen, resize, rotate and adding special effects to an image. Install ImageMagick with Imagick PHP extension for PHP and ImageMagick-perl extension for Perl is explained in this article.

To Install ImageMagick

Install the required packages to compile imagick PHP extension.

[root@linuxhelp ~]# yum install php-pear php-devel gcc -y
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirror.nbrc.ac.in
 * extras: mirror.nbrc.ac.in
 * updates: mirror.nbrc.ac.in
Resolving Dependencies
-->  Running transaction check
--->  Package gcc.x86_64 0:4.8.5-4.el7 will be installed
-->  Processing Dependency: libgomp = 4.8.5-4.el7 for package: gcc-4.8.5-4.el7.x86_64
.
.
.
Dependency Installed:
  autoconf.noarch 0:2.69-11.el7                 automake.noarch 0:1.13.4-3.el7                   glibc-devel.x86_64 0:2.17-106.el7_2.6     
  glibc-headers.x86_64 0:2.17-106.el7_2.6       kernel-headers.x86_64 0:3.10.0-327.18.2.el7      pcre-devel.x86_64 0:8.32-15.el7_2.1       
  perl-Data-Dumper.x86_64 0:2.145-3.el7         perl-Test-Harness.noarch 0:3.28-3.el7            perl-Thread-Queue.noarch 0:3.02-2.el7     
  php-process.x86_64 0:5.4.16-36.1.el7_2.1     

Dependency Updated:
  libgomp.x86_64 0:4.8.5-4.el7                                                                                                              

Complete!


After installing php-pear ,php-devel and gcc packages, install ImageMagick software for Perl and PHP using the following command.

[root@linuxhelp ~]# yum install ImageMagick ImageMagick-devel ImageMagick-perl -y
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirror.nbrc.ac.in
 * extras: mirror.nbrc.ac.in
 * updates: mirror.nbrc.ac.in
Resolving Dependencies
-->  Running transaction check
--->  Package ImageMagick.x86_64 0:6.7.8.9-13.el7_2 will be installed
-->  Processing Dependency: libwmflite-0.2.so.7()(64bit) for package: ImageMagick-6.7.8.9-13.el7_2.x86_64
-->  Processing Dependency: libImath.so.6()(64bit) for package: ImageMagick-6.7.8.9-13.el7_2.x86_64
.
.
.
Dependency Updated:
  bzip2.x86_64 0:1.0.6-13.el7                  bzip2-libs.x86_64 0:1.0.6-13.el7                freetype.x86_64 0:2.4.11-11.el7              
  ghostscript.x86_64 0:9.07-18.el7             ghostscript-cups.x86_64 0:9.07-18.el7           jasper-libs.x86_64 0:1.900.1-29.el7          
  libICE.x86_64 0:1.0.9-2.el7                  libSM.x86_64 0:1.2.2-2.el7                      libX11.x86_64 0:1.6.3-2.el7                  
  libX11-common.noarch 0:1.6.3-2.el7           libXext.x86_64 0:1.3.3-3.el7                    libxcb.x86_64 0:1.11-4.el7                   
  zlib.x86_64 0:1.2.7-15.el7                  

Complete!

Now you need to compile the imagick for PHP extension by executing the following ‘ pecl‘ command. This will install the ImageMagick and also imagick PHP extension module ‘ imagick.so‘ under /usr/lib/php/modules directory.

If you are using 64-bit system, the module directory path should be /usr/lib64/php/modules.

[root@linuxhelp ~]# pecl install imagick
WARNING: channel " pecl.php.net"  has updated its protocols, use " pecl channel-update pecl.php.net"  to update
downloading imagick-3.4.1.tgz ...
Starting to download imagick-3.4.1.tgz (239,829 bytes)
.................................................done: 239,829 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] : 
.
.
.
Build process completed successfully
Installing ' /usr/lib64/php/modules/imagick.so' 
Installing ' /usr/include/php/ext/imagick/php_imagick_shared.h' 
install ok: channel://pecl.php.net/imagick-3.4.1
configuration option " php_ini"  is not set to php.ini location
You should add " extension=imagick.so"  to php.ini

It will prompt you to supply Imagemagick installation prefix and you need to press enter to auto detect.

Next, add the ‘ imagick.so‘ extension to ‘ /etc/php.ini‘ file.

[root@linuxhelp ~]# echo extension=imagick.so > >  /etc/php.ini

Now restart Apache web server.

[root@linuxhelp ~]# systemctl restart httpd.service

Check imagick PHP extension by executing the following command.

[root@linuxhelp ~]# php -m | grep imagick
imagick

Alternatively, create a file known as ‘ info.php‘ under site root directory.

[root@linuxhelp ~]# vim /var/www/html/info.php
Append the following code.

< ?php
     phpinfo () 
?> 


Finally Open the browser and enter ‘ http://localhost/info.php‘ or ‘ http://ip-addresss/info.php‘ and check the imagick extension.

browser

Tags:
jackson
Author: 

Comments ( 0 )

No comments available

Add a comment
{{postCtrl.cmtErrMsg}}

Frequently asked questions ( 5 )

Q

I tried installing one php extension called imagick in my CentOS machine to use with php. It returns the following error, pecl install imagick ... ... make: *** [imagick.lo] Error 1 ERROR:

A

The error shown that there is a need of some dependencies to install imagick extension. And the dependency module required for imagick is pcre_devel. Try after installing this module

Q

I need to compile Image Magick from source, how to do it

A

You can follow this tutorial https://www.linuxhelp.com/how-to-install-imagemagick-from-source-on-centos-7/ for source installation

Q

What is the command to convert jpg to png

A

You can use, convert image.jpg image.png

Q

How to check Image Magick versoin from CLI

A

use convert --version command

Q

How to check Image Magick versoin from CLI?

A

Following command is used to check the version

use convert --version command

Back To Top!
Rank
User
Points

Top Contributers

userNamenaveelansari
135850

Top Contributers

userNameayanbhatti
92510

Top Contributers

userNamehamzaahmed
32150

Top Contributers

1
userNamelinuxhelp
31040

Top Contributers

userNamemuhammadali
24500
Can you help Elijah ?
Remote Desktop Connection Has Stopped Working

When accessing my remote machine server using remote desktop on a windows machine I am getting this error

forum (1)

Networking
  • Routing
  • trunk
  • Netmask
  • Packet Capture
  • domain
  • HTTP Proxy
Server Setup
  • NFS
  • KVM
  • Memory
  • Sendmail
  • WebDAV
  • LXC
Shell Commands
  • Cloud commander
  • Command line archive tools
  • last command
  • Shell
  • terminal
  • Throttle
Desktop Application
  • Linux app
  • Pithos
  • Retrospect
  • Scribe
  • TortoiseHg
  • 4Images
Monitoring Tool
  • Monit
  • Apache Server Monitoring
  • EtherApe 
  • Arpwatch Tool
  • Auditd
  • Barman
Web Application
  • Nutch
  • Amazon VPC
  • FarmWarDeployer
  • Rukovoditel
  • Mirror site
  • Chef
Contact Us | Terms of Use| Privacy Policy| Disclaimer
© 2025 LinuxHelp.com All rights reserved. Linux™ is the registered trademark of Linus Torvalds. This site is not affiliated with linus torvalds in any way.