imgmin: optimize JPEG images automatically

image_editor_compWe explored some utilities to optimize png, jpeg and gif images earlier. Though they yield very good results, a common problem is the need to specify the optimization level manually. Most users would use a 80%-85% level in fear of ruining the image quality. imgmin is a promising project that attempts solves this problem by calculating the optimal level mathematically and automating the process without manual intervention.

imgmin is the result of extensive research work. It uses a lossless mechanism to generate the optimized images by manipulating pixel blocks. The metric the author uesd is mean pixel error rate: the amount of change, on average, each pixel in the new image is from the original. imgmin generates several versions of the image and selects the lowest quality setting that produces a mean pixel error rate < 1.0.

While regular images yield excellent results with good gains on file size, low color JPEG images, such as gradients and low- contrast patterns used in backgrounds deliver unacceptable results at ~1 mean pixel error rate. Currently images with < 4096 colors are passed through unchanged to work around this.

At the time of writing, imgmin works with JPEG imges only.


You have to compile imgmin from source at the time of writing. On Ubuntu, run:

$ sudo apt-get install -y autoconf libmagickwand-dev pngnq pngcrush pngquant
$ git clone
$ cd imgmin
$ autoreconf -fi
$ ./configure
$ make
$ sudo make install


As simple as it can be!

$ imgmin original.jpg optimized.jpg


Features: 4.8/5
Usability: 5/5

On GitHub: imgmin

Leave a Reply

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