How to Use MozJPEG

You can shrink your JPGs by up to 40% by optimizing them with MozJPEG.

Installing MozJPEG

You can either build the binaries or install them via NPM.

npm install --global mozjpeg

Usage with JPGs

This is how you optimize JPGs

mozjpeg source.jpg > output.jpg

You will lose some quality in the process though.

Usage With non-JPG Formats

First, convert your files to JPGs with quality 100. You can use XnConvert or GIMP. I’ll use ImageMagick

magick -quality 100 source.png source.jpg

Then you can run it through MozJPEG with desired quality

mozjpeg -q 80 source.jpg > output.jpg

You set the quality at the end, instead of at the beginning, because it gives images better fidelity.

MozJPEG technically supports PNG, but you’ll need to make a special build for this to work.

GUI Tools

Most are simple “image optimizers” where you drop JPGs to shrink them. They don’t offer much in terms of configuration though. Here is one – E-Mage.

I found 2 other tools that actually allowed various file formats as input and to set the right quality. Unfortunately, neither of them worked.

Leave a Reply

Your email address will not be published. Required fields are marked *