ImageMagick is an open-source, free, and powerful application used for creating, editing, and converting images into various formats. Some of the images formats it supports include PNG, GIF, JPEG, PDF, EXR, WebP, and TIFF. Using ImageMagick, you can resize, rotate, crop, distort, flip, modify image colors, and apply a number of effects. You can also add text and different shapes to images.
Here at LinuxAPT, as part of our Server Management Services, we regularly help our Customers to perform related Linux system Application software Installation queries.
In this context, we shall look into how to install ImageMagick on CentOS.
Here, we will cover the different methods of installing ImageMagick as outlined below:
ImageMagick is available in the Yum default repositories. In this method, we will install ImageMagick via the Yum repository. Follow the below steps for the installation procedure:
i. Start by installing some prerequisites packages in your system using the command below:
$ sudo yum install gcc php-devel php-pear
If prompted, provide the sudo password, and then it will start installing all the prerequisites. Once the prerequisites are installed, move on to the next step.
ii. Now you can install ImageMagick on your system. Use the command below to do so:
$ sudo yum install ImageMagick ImageMagick-devel ImageMagick-perl
If prompted, provide the sudo password. After this, the installation of ImageMagick will be started on your system.
Once ImageMagick is installed, you can verify it by running the command below:
$ convert --version
The result will display the version of ImageMagick installed on our machine.
Here, we will install ImageMagick via source code. Follow the below steps for the installation procedure:
i. First, install some development tools on your system using the command below:
$ sudo yum groupinstall 'Development Tools'
Then install some other packages using the command below:
$ sudo yum install freetype-devel libjpeg-devel jasper-devel libpng-devel bzip2-devel libtiff-devel giflib-devel zlib-devel ghostscript-devel djvulibre-devel libwmf-devel librsvg2-devel libtool-ltdl-devel libX11-devel lcms-devel libXext-devel libXt-devel libxml2-devel OpenEXR-devel php-devel
ii. Now, download ImageMagick source code by running this command in the Terminal:
$ wget https://www.imagemagick.org/download/ImageMagick.tar.gz
The downloaded file will be saved in your current directory as ImageMagick.tar.gz.
iii. Extract the archive by running the command below in the Terminal:
$ tar xvzf ImageMagick.tar.gz
You can find the extracted archive in your current directory as ImageMagick-7.1.0-4.
iv. Move inside the extracted archive directory and run the configure script using the commands below:
$ cd ImageMagick-7.1.0-4/
$ sudo ./configure
This command will check for all the dependencies that are required to build and install the package.
v. Now, you will need to build the package by running this command:
$ sudo make
vi. Then use this command to install the package:
$ sudo make install
Now it will take a while, after which ImageMagick will be installed on your machine.
To verify the installation of ImageMagick, run this command:
$ magick --version
The result will display the version of ImageMagick installed on our machine.
If in case you need to uninstall ImageMagick from your system, you can do so using the methods below:
If ImageMagick has been installed via repository, it can be uninstalled using the command below:
$ sudo yum remove imagemagick
It will remove ImageMagick and its dependencies from your system.
If ImageMagick has been installed via source code, it can be uninstalled using the commands below:
Move inside the ImageMagick directory using the command below:
$ cd ImageMagick-7.1.0-4/
Then uninstall it as follows:
$ sudo make uninstall
This article covers how to install ImageMagick on the CentOS machine via different methods. Infact, ImageMagick provides a graphical interface for working with images, it also provides commands to resize an image, blur, crop, draw on, flip, join, re-sample, and much more.