Install jpegoptim powered by MozJPEG on CentOS/RHEL or Amazon Linux

by , , revisited on

We have by far the largest RPM repository with dynamic stable NGINX modules and VMODs for Varnish 4.1 and 6.0 LTS. If you want to install NGINX, Varnish, and lots of useful modules for them, this is your one-stop repository to get all performance-related software.
You have to maintain an active subscription in order to be able to use the repository!

The jpegoptim is the utility of choice for optimizing JPEG files. By default, it uses the standard JPEG encoding library on your system. However, there is a relatively new player in the town of JPEG encoders – MozJPEG.

MozJPEG encoder provides improvements compared to the standard libraries by reducing the size of JPEG files further. So if you couple jpegoptim with MozJPEG, – you get furthermore smaller files without losing any quality!

Install jpegoptim with MozJPEG support

Our repository has jpegoptim compiled with MozJPEG linked in statically. So all you need to do is add up our repository and install the package:

sudo yum -y install
sudo yum -y install jpegoptim

Use it!

Use jpegoptim as you would normally, by simply running jpegoptim /path/to/file, or while providing whatever switches required for your use cases.
The optimized files will be just more lightweight, compared to standard libjpeg-turbo, at no cost of quality!

Example lossless optimization comparison

Using jpegoptim with standard JPEG encoder

beautiful-girl-stands-park_8353-5085.jpg 626×417 24bit N JFIF [OK] 69291 –> 67808 bytes (2.14%), optimized.

Using jpegoptim with MozJPEG

beautiful-girl-stands-park_8353-5085.jpg 626×417 24bit N JFIF [OK] 69291 –> 65898 bytes (4.90%), optimized.

Most of the files we tried provided similar extra 2-3% improvements. So no excuse not to leverage the power of MozJPEG!

Want all your apps to make use of MozJPEG? Read how to install the MozJPEG drop-in library.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.