Building ImageMagick portable binary files under centos7

Installation dependence

First, let’s install the format dependencies that ImageMagick requires.
Let’s use root to execute the following command.

yum install -y libjpeg libjpeg-devel
yum install -y libpng libpng-devel
yum install -y libtiff libtiff-devel
yum install -y libungif libungif-devel
yum install -y freetype freetype-devel
yum install -y zlib zlib-devel
yum install -y pkg-config
yum install -y gcc-c++

Download and unzip the source code

If no error message is prompted, the dependency is successfully installed.

Now, we execute the following command to download the source code for ImageMagick.

cd $HOME

After completing the download, we execute the following command to decompress the source code.

tar zxf ImageMagick.tar.gz

Next, we go to the ImageMagick directory.

cd $HOME/ImageMagick-*

Build binaries

Now, we execute the following commands for pre-build configuration and dependency checking.

./configure --disable-installed --disable-shared --enable-delegate-build --disable-dependency-tracking --with-x=no --without-perl --with-freetype=no --with-magick-plus-plus=no --without-frozenpaths --with-bzlib=no --with-png=yes --with-jpeg=yes --with-tiff=yes --prefix=$HOME/ImageMagick-Final

If no error is prompted, then we execute the following code.

make clean && make && make install

If there are no errors, we have successfully built ImageMagick’s portable binary.

The path to the built portable binary is $HOME/ imagemagick-final /bin/magick, which we can copy to other CentOS systems, and we don’t need to install any dependencies.

We can call it from the console by typing the following command.

./magick 1.jpg 1.png