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.