sudo apt-get install optipng installs an outdated version of OptiPNG (0.6.x). To get the newest version, you’ll have to compile from source code. And that ain’t bad.
This tutorial assumes you have build-essentials library installed. If not, you can check out this Compiling: Easy How To article on Ubuntu to get set up and gain a better understanding of what is going on here.
- Download the source code with this command. This may work if SourceForge doesn’t change their URL structure.
If the that URL doesn’t work, start searching for the new download link at the OptiPNG site.
- Untar it
tar xvf optipng-0.7.3.tar.gz
- Go into the extracted folder, compile, and install it
cd optipng-0.7.3 ./configure make sudo checkinstall
This will compile OptiPNG and make it accessible by commandline.
Try out OptiPNG! Run this command to see the version number:
The result should be something like this:
OptiPNG version 0.7.4 Copyright (C) 2001-2012 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.4.12 and zlib version 1.2.7-optipng
You are ready to optimize PNG files now!