Getting Started with MozJPEG: Compiling and Installing on CentOS 7
mozjpegcentos 7image compressioncjpegbuild from source
Published·Modified·
Official Tutorial: https://github.com/mozilla/mozjpeg/blob/master/BUILDING.txt
Source Code: https://github.com/mozilla/mozjpeg/releases
Requires the nasm environment:
yum -y install build-essential nasm
Using version 3.3.1 as an example:
cd ~
wget -O "mozjpeg-3.3.1.tar.gz" https://codeload.github.com/mozilla/mozjpeg/tar.gz/v3.3.1
tar -zxvf mozjpeg-v3.3.1.tar.gz
cd mozjpeg-3.3.1
autoreconf -fiv
./configure
make
make install

Installation Directory
/opt/mozjpeg/bin
-rwxr-xr-x 1 root root 56752 Nov 2 23:26 cjpeg
-rwxr-xr-x 1 root root 45792 Nov 2 23:26 djpeg
-rwxr-xr-x 1 root root 53424 Nov 2 23:26 jpegtran
-rwxr-xr-x 1 root root 13536 Nov 2 23:26 rdjpgcom
-rwxr-xr-x 1 root root 64456 Nov 2 23:26 tjbench
-rwxr-xr-x 1 root root 13552 Nov 2 23:26 wrjpgcom
Usage Example
/opt/mozjpeg/bin/cjpeg -quality 80 a.jpg > a1.jpg

The image was compressed from 4.9MB to 1.4MB.