October 16, 2012

Installing OptiPNG 0.7.3 (or newer) on Ubuntu 12.04

Unfortunately 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.

  1. Download the source code with this command. This may work if SourceForge doesn’t change their URL structure. wget http://downloads.sourceforge.net/project/optipng/OptiPNG/optipng-0.7.4/optipng-0.7.4.tar.gz

If the that URL doesn’t work, start searching for the new download link at the OptiPNG site.

  1. Untar it tar xvf optipng-0.7.3.tar.gz

  2. 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.

  3. Try out OptiPNG! Run this command to see the version number:

    optipng -v

    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!