How to Compile imagemagick from source, configured with webp on Centos 7.6

How to Compile imagemagick 7.0 from source, configured with webp on Centos 7.6

Note:

You can use ImageMagick without imagick but you need to install both the ImageMagick and imagick installed to run it.

Download Link :

click here

Process:

Check the version of PHP

[root@linuxhelp ~]# php -v
PHP 7.2.17 (cli) (built: Apr  3 2019 10:02:16) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies

Check whether the imagick has been present or not.

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

Install the group of packages with developed libraries

 [root@linuxhelp ~]# yum groupinstall "Development Tools" -y
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirror.dhakacom.com
* epel: my.fedora.ipserverone.com
* extras: mirror.nbrc.ac.in
* remi-php72: fr2.rpmfind.net
* remi-safe: fr2.rpmfind.net
* updates: mirror.nbrc.ac.in
base                                                                                                                   | 3.6 kB  00:00:00     
Resolving Dependencies
--> Running transaction check
.
.
.
.
.
Dependency Updated:
 libgcc.x86_64 0:4.8.5-36.el7_6.2             libgomp.x86_64 0:4.8.5-36.el7_6.2             libstdc++.x86_64 0:4.8.5-36.el7_6.2            

Complete!

Install gcc pear and devel packages as follows

 [root@linuxhelp ~]# yum install gcc php-pear php-devel -y
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirror.dhakacom.com
 * epel: my.fedora.ipserverone.com
 * extras: mirror.nbrc.ac.in
 * remi-php72: fr2.rpmfind.net
 * remi-safe: fr2.rpmfind.net
 * updates: mirror.nbrc.ac.in
Package gcc-4.8.5-36.el7_6.2.x86_64 already installed and latest version
Resolving Dependencies
--> Running transaction check
---> Package php-devel.x86_64 0:7.2.22-1.el7.remi will be installed
.
.
.
.
 Dependency Updated:
  openssl.x86_64 1:1.0.2k-16.el7_6.1          openssl-libs.x86_64 1:1.0.2k-16.el7_6.1         php.x86_64 0:7.2.22-1.el7.remi                
  php-cli.x86_64 0:7.2.22-1.el7.remi          php-common.x86_64 0:7.2.22-1.el7.remi           php-gd.x86_64 0:7.2.22-1.el7.remi             
  php-json.x86_64 0:7.2.22-1.el7.remi         php-mbstring.x86_64 0:7.2.22-1.el7.remi         php-mysqlnd.x86_64 0:7.2.22-1.el7.remi        
  php-pdo.x86_64 0:7.2.22-1.el7.remi          php-xml.x86_64 0:7.2.22-1.el7.remi             

Complete!

Install the dependencies that are required for the building of ImageMagick Software

[root@linuxhelp ~]# yum -y install bzip2-devel libtiff-devel giflib-devel ghostscript-devel libwmf-devel jasper-devel libtool-ltdl-devel libXext-devel libXt-devel OpenEXR-devel libwebp-devel rpmdevtool libtool-ltdl-devel ImageMagick-devel freetype-devel ghostscript-devel libwmf-devel jasper-devel lcms-devel bzip2-devel librsvg librsvg2 librsvg2* liblpr-1 liblqr-1-devel libtool-ltdl-devel autotrace-devel freetype +bytecode graphviz gs wmf jbig jpeg2 lcms jpeg libjpeg libjpeg-devel libtiff
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirror.dhakacom.com
* epel: my.fedora.ipserverone.com
* extras: mirror.nbrc.ac.in
* remi-php72: fr2.rpmfind.net
* remi-safe: fr2.rpmfind.net
* updates: mirror.nbrc.ac.in
Package libjpeg-turbo-1.2.90-6.el7.x86_64 already installed and latest version
Package libtiff-4.0.3-27.el7_3.x86_64 already installed and latest version
Resolving Dependencies
--> Running transaction check
.
.
.
.
.
Dependency Updated:
 ghostscript.x86_64 0:9.07-31.el7_6.11       ghostscript-cups.x86_64 0:9.07-31.el7_6.11       glib2.x86_64 0:2.56.1-4.el7_6                
 libblkid.x86_64 0:2.23.2-59.el7_6.1         libmount.x86_64 0:2.23.2-59.el7_6.1              libsmartcols.x86_64 0:2.23.2-59.el7_6.1      
 libuuid.x86_64 0:2.23.2-59.el7_6.1          pango.x86_64 0:1.42.4-2.el7_6                    util-linux.x86_64 0:2.23.2-59.el7_6.1        

Complete!

Download The ImageMagick with the following link

 [root@linuxhelp ~]# wget https://imagemagick.org/download/ImageMagick.tar.gz
--2019-09-06 08:09:29--  https://imagemagick.org/download/ImageMagick.tar.gz
Resolving imagemagick.org (imagemagick.org)... 198.72.81.86
Connecting to imagemagick.org (imagemagick.org)|198.72.81.86|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 13741727 (13M) [application/x-gzip]
Saving to: ‘ImageMagick.tar.gz’

100%[====================================================================================================>] 13,741,727  1.12MB/s   in 13s    

2019-09-06 08:09:44 (1001 KB/s) - ‘ImageMagick.tar.gz’ saved [13741727/13741727]

Extract the atr file of ImageMAgick

 [root@linuxhelp ~]# tar xzf ImageMagick.tar.gz 

List the directory

 [root@linuxhelp ~]# ls 
anaconda-ks.cfg  Documents  ImageMagick-7.0.8-63  initial-setup-ks.cfg  Pictures  remi-release-7.rpm  Videos
Desktop          Downloads  ImageMagick.tar.gz    Music                 Public    Templates

Naviagate To ImageMagick

[root@linuxhelp ~]# cd ImageMagick-7.0.8-63/

Configure With webp as follows

 [root@linuxhelp ImageMagick-7.0.8-63]# ./configure --with-webp=yes
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... x86_64-pc-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
.
.
.
.
. 
    CXX             = g++
    CXXFLAGS        = -g -O2 -mtune=corei7-avx -pthread
    FEATURES        = DPC HDRI Cipher OpenMP
    DELEGATES       = bzlib mpeg fontconfig freetype jng jpeg lzma openexr pango png ps tiff webp wmf x xml zlib
==============================================================================

Build the imageMagick Software as follows

[root@linuxhelp ImageMagick-7.0.8-63]# make
make  all-am
make[1]: Entering directory `/root/ImageMagick-7.0.8-63'
 CC       utilities/magick.o
 CC       MagickCore/libMagickCore_7_Q16HDRI_la-accelerate.lo
 CC       MagickCore/libMagickCore_7_Q16HDRI_la-animate.lo
 CC       MagickCore/libMagickCore_7_Q16HDRI_la-annotate.lo
.
.
.
.
.
cp -f MagickCore/ImageMagick.pc MagickCore/ImageMagick-7.Q16HDRI.pc
cp -f MagickCore/MagickCore.pc MagickCore/MagickCore-7.Q16HDRI.pc
cp -f MagickWand/MagickWand.pc MagickWand/MagickWand-7.Q16HDRI.pc
cp -f Magick++/lib/Magick++.pc Magick++/lib/Magick++-7.Q16HDRI.pc
make[1]: Leaving directory `/root/ImageMagick-7.0.8-63'

Install the Imagemagick from the built software

[root@linuxhelp ImageMagick-7.0.8-63]# make install
make  install-am
make[1]: Entering directory `/root/ImageMagick-7.0.8-63'
make[2]: Entering directory `/root/ImageMagick-7.0.8-63'
/usr/bin/mkdir -p '/usr/local/lib'
/bin/sh ./libtool   --mode=install /usr/bin/install -c   MagickCore/libMagickCore-7.Q16HDRI.la MagickWand/libMagickWand-7.Q16HDRI.la Magick++/lib/libMagick++-7.Q16HDRI.la '/usr/local/lib'
.
.
.
.
.
.
/usr/bin/install -c -m 644 MagickCore/ImageMagick.pc MagickCore/MagickCore.pc MagickCore/ImageMagick-7.Q16HDRI.pc MagickCore/MagickCore-7.Q16HDRI.pc MagickWand/MagickWand.pc MagickWand/MagickWand-7.Q16HDRI.pc Magick++/lib/Magick++.pc Magick++/lib/Magick++-7.Q16HDRI.pc '/usr/local/lib/pkgconfig'
make[2]: Leaving directory `/root/ImageMagick-7.0.8-63'
make[1]: Leaving directory `/root/ImageMagick-7.0.8-63'

Create a link to the shared libraries as follows

 [root@linuxhelp ImageMagick-7.0.8-63]# ldconfig /usr/local/lib

Verify the version of ImageMagick as follows

 [root@linuxhelp ImageMagick-7.0.8-63]# identify --version
Version: ImageMagick 7.0.8-63 Q16 x86_64 2019-09-06 https://imagemagick.org
Copyright: © 1999-2019 ImageMagick Studio LLC
License: https://imagemagick.org/script/license.php
Features: Cipher DPC HDRI OpenMP(3.1) 
Delegates (built-in): bzlib fontconfig freetype jng jpeg lzma openexr pangocairo png tiff webp wmf x xml zlib

Check whether the ImageMagick has been installed or not.

[root@linuxhelp ImageMagick-7.0.8-63]# display

Install the imagick module as follows

[root@linuxhelp ImageMagick-7.0.8-63]# 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.4.tgz ...
Starting to download imagick-3.4.4.tgz (253,434 bytes)
.....................................................done: 253,434 bytes
19 source files, building
running: phpize
Configuring for:
PHP Api Version:         20170718
Zend Module Api No:      20170718
Zend Extension Api No:   320170718
Please provide the prefix of ImageMagick installation [autodetect] : 
building in /var/tmp/pear-build-rootXs0xvH/imagick-3.4.4

.
.
.
.

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.4
configuration option "php_ini" is not set to php.ini location
You should add "extension=imagick.so" to php.ini

Add the extension to the PHP Configuration file

[root@linuxhelp ImageMagick-7.0.8-63]# vim /etc/php.ini
extension=imagick.so

Check whether the imagick module is resent or not

 [root@linuxhelp ImageMagick-7.0.8-63]# php -m |grep imagick
Imagick.

With this, Compilation of ImageMagick from Source With Webp Configuration On CentOS 7.6 comes to end.

FAQ
Q
What is Imagick in ImageMagick?
A
Imagick is a PHP API for ImageMagick.
Q
What is the use of ldconfig in ImageMagick?
A
ldconfig creates a necessary link and cache to the shared libraries in ImageMagick.
Q
Does ImageMagick Works without Imagick installed?
A
No, ImageMagick doesn't work without Imagick installed.
Q
What does configure command do in ImageMagick?
A
Configure command in ImageMagick takes responsibility in checking whether all the dependencies are present or not to build and install the software.
Q
What is the use of group install In ImageMagick?
A
group install in ImageMagick installs a group of packages rather one by one.