Install Latest OptiPNG for EWWW Image Optimizer on WordPress

EWWW Image Optimizer is my go to WordPress plugin for compressing my PNGs. EWWW Image Optimizer uses open source sofrware like OptiPNG and pngquant to reduce the image size after I upload them.

I like to have the latest software in case of security patches, bugfixes or performance improvements. While the current Debian and Ubuntu versions will have the latest security-patched versions of sotware, they may not have versions with performance improvements or bug fixes.

This guide will show you how to build the latest OptiPNG for use with EWWW Image Optimizer on your VPS (Digital Ocean or Vultr) or dedicated server.

Install Latest OptiPNG 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 optipng version

optipng -V

You will get the optipng version and build date.

You can check your optipng version

OptiPNG 0.6.4: Advanced PNG optimizer.
Copyright (C) 2001-2010 Cosmin Truta.

This program is open-source software. See LICENSE for more details.

Portions of this software are based in part on the work of:
  Jean-loup Gailly and Mark Adler (zlib)
  Glenn Randers-Pehrson and the PNG Development Group (libpng)
  Miyasaka Masaru (BMP support)
  David Koblas (GIF support)

Using libpng version 1.2.49 and zlib version 1.2.7

You will get the optipng version and build date.

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

To build the latest OptiPNG run these commands one after another

We are entering the /tmp folder, downloading the latest OptiPNG source tarball, unpacking it, building it and installing it

cd /tmp
OPTIPNGLATEST=$(wget http://optipng.sourceforge.net/ -O - | grep tar.gz | awk -F "[\"]" '{print $4}')
wget $OPTIPNGLATEST -O optipng.tar.gz
tar -xf optipng.tar.gz
cd optipng*
./configure --prefix=/usr
make
sudo make install

You can check your optipng version again

optipng -V

You will get the optipng version and build date.

OptiPNG version 0.7.6
Copyright (C) 2001-2016 Cosmin Truta and the Contributing Authors.

This program is open-source software. See LICENSE for more details.

Portions of this software are based in part on the work of:
  Jean-loup Gailly and Mark Adler (zlib)
  Glenn Randers-Pehrson and the PNG Development Group (libpng)
  Miyasaka Masaru (BMP support)
  David Koblas (GIF support)

Using libpng version 1.6.21 and zlib version 1.2.8-optipng

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 latest changelog and features here to see if there are security issues or new features for OptiPNG.