Images

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

by , , revisited on


We have by far the largest RPM repository with NGINX module packages and VMODs for Varnish. If you want to install NGINX, Varnish, and lots of useful performance/security software with smooth yum upgrades for production use, this is the repository for you.
Active subscription is required.

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 https://extras.getpagespeed.com/release-latest.rpm
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.

%d bloggers like this: