Recently, I was working on image processing service, and finally chose to use GraphicsMagick for image processing

Website installation steps: www.graphicsmagick.org/INSTALL-uni…

Pre-steps:

The libjpeg and libpng libraries must be installed before GM is installed on the Mac or Linux operating system. Otherwise, the command cannot process JPG and PNG files and the following error message is displayed: No decode delegate for this image format (XXX).

For Linux, run the yum install -y libpng-devel libjpeg-devel libtiff-devel jasper-devel freetype-devel libtool-ltdl-devel* command

Mac Installation Procedure

  1. Download zip packages for both libraries:
Libpng libjpeg: http://www.ijg.org/files/jpegsrc.v9b.tar.gz:  ftp://ftp-osl.osuosl.org/pub/libpng/src/archive/gz/libpng16/libpng-1.6.29.tar.gzCopy the code
  1. The installation steps for both libraries are the same, using libjpeg as an example:
tar -xzvf jpegsrc.v9b.tar.gz
cd jpeg-9b
./configure
make && make install
Copy the code

Install the GraphicsMagick

Mac Installation Procedure

Step 1: Download

Select version download from website: https://sourceforge.net/projects/graphicsmagick/files/graphicsmagick/1.3.36/

Into the specified folder, such as: the tar – XVF GraphicsMagick – 1.3.36. Tar. Gz – C/Users/user/Public/imageTool /

Step 2: Configure & install

Enter the folder: CD/Users/user/Public/imageTool/GraphicsMagick – 1.3.36

Set the installation path & installation:

./configure --prefix=/Users/user/Public/imageTool/GraphicsMagick-x
make && make install
Copy the code

Setting environment variables:

# GraphicsMagick
export GMAGICK_HOME="/Users/user/Public/imageTool/GraphicsMagick-x"
export PATH="$GMAGICK_HOME/bin:$PATH"
export LD_LIBRARY_PATH="$GMAGICK_HOME/lib/"
#end GraphicsMagick
Copy the code

Step 3: Test

View the GM version: gM-version

Test image scaling: gm convert/Users/user/Downloads/test. The PNG – resize “50 x50”

Linux Installation Procedure

yum install -y gcc make yum install -y libpng-devel libjpeg-devel libtiff-devel jasper-devel freetype-devel libtool-ltdl-devel* curl -o image.tar.gz https://jaist.dl.sourceforge.net/project/graphicsmagick/graphicsmagick/1.3.36/GraphicsMagick-1.3.36.tar.gz tar ZXVF. - Image.tar. gz CD Graphicsmagick-1.3.36 /./configure --prefix=/app/ graphicsmagick-x make && make installCopy the code

Windows Installation Procedure

The official download page: www.graphicsmagick.org/download.ht…

GM download address: ftp://ftp.graphicsmagick.org/pub/GraphicsMagick/windows/GraphicsMagick-1.3.36-Q16-win64-dll.exe

Windows GM supports PNG and JPG itself, requiring no additional software installation. Download directly click install, always next line, will automatically configure the environment variables, successful installation can be used, very simple!

Other Problem Records

1. The following errors occur when watermarking pictures:

Solution: Install Ghostscript

Linux: yum install -y ghostscript

Mac: Brew install Ghostscript or sudo port install ghostscript