Install Latest pngquant for EWWW Image Optimizer on WordPress

EWWW Image Optimizer is what I use for compressing the PNG files on WP Bullet on the fly. It uses free software like pngquant to reduce the image size of the banners after I upload them. For some reason pngquant is pretty outdated in the Debian and Ubuntu repository. This guide will show you how to build the latest pngquant for use with EWWW Image Optimizer on your VPS or dedicated server.

Install Latest pngquant for EWWW Image Optimizer on WordPress

These are the programs necessary for EWWW Image Optmizer on Debian and Ubuntu

sudo apt-get update
sudo apt-get install pngtools pngquant optipng gifsicle libjpeg-progs -y

You can check your pngquant version

pngquant -V

You will get the pngquant version and build date.

2.3.0 (July 2014)

That’s a bit too old for me. To install the latest pngquant from github

sudo apt-get update
sudo apt-get install build-essential liblcms2-dev libpng-dev -y

Enter your temporary directory, download the latest pngquant and unpack it

cd /tmp
wget https://github.com/pornel/pngquant/tarball/master -O pngquant.tar
tar -xf pngquant.tar
cd pornel-pngquant*
./configure --prefix=/usr

You should see output similar to this

  Compiler: gcc
     Debug: no
       SSE: yes
    OpenMP: no
    libpng: shared (1.6.25)
      zlib: shared (1.2.8)
     lcms2: shared (2.6)

Now actually compile pngquant

sudo make
sudo make install

Check the version of pngquant now

pngquant -V

There we go

2.7.3 (August 2016)

Under Settings > EWWW Image Optimizer you can see the versions it is using

ewww-image-optimizer-installed-programs

If you do not see the updated version you may need to tell EWWW to use it explicitly.

Under Advanced Settings tab check Use System paths and click Save Changes.

You can check the pngquant changelogs every once in a while to see if you should upgrade to the latest pngquant to take advantage of any new features.