Compile and run mozjpeg under CentOS 6.5

Like Mozilla says:

This project's goal is to reduce the size of JPEG files without reducing quality or compatibility with the vast majority of the world's deployed decoders.

I wanted to optimize the images of one of my websites so I decided to use mozjpeg. Unfortunately they dont provide any binaries so I had to compile it myself.

Here is the list of commands to compile and run it:

yum install wget autoconf automake gcc nasm  
wget https://github.com/mozilla/mozjpeg/releases/download/v3.1/mozjpeg-3.1-release-source.tar.gz  
tar xvfz mozjpeg-3.1-release-source.tar.gz  
cd mozjpeg  
./configure
make  
make install  

Done, you can now run jpegtran to optimize your images.
Example replacing the original file:

jpegtran -copy none -optimize -outfile 78.jpg 78.jpg

Recursive optimization:

find . -iname "*.jpg" -exec jpegtran -copy none -optimize -outfile {} {} \;

comments powered by Disqus