contents

Patching libpng

libanim

About
Source code

Documentation

Building libpng

Help

Check the Pledgie page on what donation money will be for.

Click here to lend your support to: Improve libanim and make a donation at www.pledgie.com !

Why is this needed?

The APNG specification was created in 2004 by Stuart Parmenter and Vladimir Vukicevic of the Mozilla Corporation, however it the PNG Group didn’t approve it and as such it will never be integrated into libpng, the group’s reference implementation. Because of this we need to patch libpng’s source with support for apng. You can read more about the history on Wikipedia.

Building it

  1. Download libpng sources from http://www.libpng.org/pub/png/libpng.html and make sure to get the .tar.gz version for unix line endings or zip for Windows line endings.
  2. Download apng patch from http://littlesvr.ca/apng/ for the respective libpng version
  3. Extract libpng
    tar -xjf libpng-X.Y.Z.tar.gz
  4. Apply patch
    cd libpng-X.Y.Z
    patch -p0 < ../libpng-X.Y.Z-apng.txt
    	
  5. Edit build-device and build-simulator scripts found in the tools directory of the libanim source code. Check the variables section to match your system SDK and your preferences.
  6. Run the script.
    LIBANIM_SOURCE/build-fat
  7. The script will create 3 files as follows:
    • libpng14.ios.a – this is usually the file you want to link against. It includes both versions (simulator + device) on a single binary.
    • libpng14.device.a
    • libpng14.simulator.a

File sizes

You may notice the static libraries are quite large (around 2MB). However, keep in mind that when you actually link the library into your project it will be striped of a lot of junk and meta data, all the way down to a few KB.