The PNG Guide is an eBook based on Greg Roelofs' book, originally published by O'Reilly.

Cross-Platform Libraries

In the next two sections, I list roughly two dozen PNG-supporting libraries and toolkits, with particular emphasis on those with the greatest cross-platform support or support for some of the less common platforms. For an up-to-date list of PNG toolkits and related code, please check the Toolkits web page and the Source Code and Libraries page at the PNG home site:

Note that I have not personally tested any of the libraries or toolkits listed here.


John Cristy's ImageMagick is a C library that provides a uniform interface to a few dozen image formats. It not only includes a standard C API but also has Perl and Python interfaces. It also provides several powerful utilities, including an X-based viewer called display, for which it is probably better known. ImageMagick is freely available in source and binary formats for Unix, VMS, Macintosh, and 32-bit Windows platforms, albeit without the display and animate tools on the Mac. (An X server is required for those two programs on the other platforms.) It uses libpng and zlib for PNG support and may be modified and distributed freely as long as its copyright is acknowledged.
Image Library

Colosseum Builders' Image Library is a C++ library that supports reading and writing PNGs, JPEGs, and several other image formats. The distribution includes demo apps for encoding, decoding, and viewing images, the accompanying documentation indicates that the library is an alpha release. Also, much of the code is described at length in The Programmer's Guide to Compressed Image Files, by John Miano, Image Library's principal author. Borland C++ Builder and Microsoft Visual C++ are explicitly mentioned on the web page, which also claims that the library is written in standard C++, implying that it should work with most compilers. Full source code is freely available, including an independent implementation of the deflate and inflate algorithms, i.e., the core routines of zlib. Image Library may be used without fee in software that is likewise free and distributed with source; otherwise, licensing fees apply. The latest release as of this writing was on 22 July 1998; this version incorrectly rejects PNG images with a zlib window size other than 32 KB.

Ulrich von Zadow's PaintLib is a C++ class library for decoding and manipulating several image formats, including PNG; version 2.0 adds an ActiveX control to the Win32 port. Like several of the available imaging toolkits, PaintLib actually uses libpng and zlib for its PNG support and provides a higher-level, unified interface to its supported formats. Source code is available, and it compiles under at least DOS, Unix, and both 16-bit and 32-bit Windows. The library may be freely used and distributed as long as its use is acknowledged.

QHTM is a 32-bit Windows control from Russell Freeman and Gipsysoft that lies somewhere between an image toolkit and an HTML browser. Specifically, it provides a programming interface that allows one to add HTML support, including PNG images, to an application. (PNG is actually supported via code from PaintLib.) QHTM 1.0 does not yet handle transparency, but support for that is planned. Like PaintLib, QHTM may be freely used and distributed as long as its use is acknowledged.
ImageVision Library

SGI's ImageVision Library is ``a toolkit for creating, processing and displaying images on all Silicon Graphics workstations,'' to quote from the web page. It actually does not read or write image files itself; all file I/O is handled by SGI's Image Format Library, which is also available for 32-bit Windows (Microsoft Visual C++ 5.0 only). According to the IRIX 6.5 documentation, IFL is still based on libpng 0.88 and zlib 1.0, but the Windows version may be more up-to-date. IRIX users compiling applications for use with current versions of libpng and zlib should take care that they don't accidentally load the older IFL code.

Imlib is another high-level, multiformat image library, currently under development by Red Hat Advanced Development (RHAD) Labs. Though developed under and mainly supported for Linux, it is written as portable Unix/X code, and source code is available for compiling on other platforms. Imlib supports programs based on both plain Xlib and on the GIMP Toolkit (GTK+). Unlike the X front ends for the demo programs presented in Chapter 13, "Reading PNG Images" and Chapter 14, "Reading PNG Images Progressively", Imlib has the great advantage of supporting most X displays, including monochrome, pseudocolor (all bit depths from 2 through 8), static color, and truecolor. On the other hand, it treats all images as 24-bit RGB, optionally with a single color marked as transparent. As of this writing, the current release is version 1.9.4, which includes a placeholder pointer for future 8-bit alpha-channel support but no indication of what level of support may eventually show up. The authors indicated in early March 1999 that alpha support was a low priority.

Apple's QuickTime is a high-level, multiformat image (and multimedia) library for Mac OS System 7.0 and later and for 32-bit Windows. Version 3.0, which natively supports reading PNG images, is included as a standard part of Mac OS 8.5, making Mac OS the first operating system for which PNG support is built in.[106] PNG is also supported unofficially in QuickTime 2.5 via a read-only PNG importer written by Sam Bushell. A future QuickTime release is expected to support writing PNG images.

[106] A developer's release of Apple's next-generation Rhapsody OS also had PNG support, but it has not yet been released as a shipping product.

Accusoft's ImageGear is a commercial imaging library that supports several dozen formats, including PNG. It is available for Unix, OS/2, Macintosh, 16-bit and 32-bit Windows (including a Visual Basic interface), and Java (both as Java classes and as Beans). The web page strongly implies that full alpha transparency is supported, too.
Java Advanced Imaging API

In November 1998 Sun's Javasoft subsidiary finally added native PNG support to Java. As of the beta release in April 1999, the Java Advanced Imaging API included both read and write support for PNG. The Advanced Imaging API requires the Java 2 SDK (formerly known as JDK 1.2) or later and will presumably be available under the same terms as Java itself.
Sixlegs PNG

Six-Legged Software's Java package reads and displays PNG images as a Java ImageProducer. It supports full alpha transparency, gamma correction, progressive display, and conversion to grayscale, plus quite a few ancillary chunk types. Write support is expected in a separate, yet-to-be-released package. The current read-only release, as of early April 1999, is version 1.0a and requires JDK 1.1 or later (for zlib). Chris Nokleberg released version 1.0a under the GNU LGPL--formerly the Library General Public License, recently renamed the Lesser General Public License since it allows linking to proprietary code. Full source code is included.
Java Image Content Handlers

The Java Image Content Handlers were originally developed by Justin Couch for his employer, ADI Limited, but the code was subsequently released as free software and is now distributed by Justin's own company, The Virtual Light Company. Several other image formats are supported in addition to PNG, including JPEG, TIFF, NetPBM, BMP, TGA, and GIF. The current release, version 0.9.1, is read-only, but write support is coming. The handlers are written for Java 2 (JDK 1.2) but will work with JDK 1.1 with only minor changes. Full source code is included; as with Sixlegs PNG, the license is the GNU LGPL.
Java PNG

VisualTek's Java PNG library is, as the name suggests, a library for use in Java programs with support for reading and writing PNG images. Its license is somewhat less than clear, however; the web page claims it is distributed under the GNU General Public License, but no source code is available, and another web page refers to a 30-day evaluation period. Apparently it may be freely used in GPL'd programs but must be licensed commercially in other programs.

Activated Intelligence's image toolkit supports a number of image formats, either ``natively'' or via Java's ImageProducer/ImageConsumer model, with both read and write support for PNG. The web site claims it is quite fast and can handle extremely large images (100 MB or more), subject only to available disk space. The package, currently version 2.0, is commercial, but the Standard edition is royalty-free; i.e., it requires no payment beyond the initial purchase.
Java Vector Graphics (JVG)

Faidon Oy-Ab's Java Vector Graphics package supports reading and writing PNG images, as well as a few other formats. The current release, version 1.0, is shareware, but the older 1.0 beta 1 (with read-only PNG support) is free. A company representative promised in November 1998 that at least the PNG portion of JVG 1.0 ``will be freeware soon,'' mainly due to the fact that Sun is including PNG support in the Java Advanced Imaging API.

Pnglets was a late addition; created by Roger E. Critchlow, Jr., and first released in April 1999, it is written entirely in JavaScript and is capable of creating palette-based PNG images on the fly. Thus it can be included on web pages, allowing the client browser (rather than the web server) to render PNG bitmaps dynamically. The author considered the initial release to be ``pre-alpha,'' but it already appeared to be relatively feature-complete; the main problems noted on the web page included a JavaScript incompatibility with Microsoft's Internet Explorer and the lack of PNG transparency support in current releases of Netscape Navigator. Pnglets is available under the GNU General Public License (GPL), which is more restrictive than the GNU LGPL. The initial version did not appear to include any special wording about how the license might affect user-written JavaScript embedded in a web page that uses Pnglets, but that will probably be clarified in a subsequent release. (The Pnglets code itself lives in a separate file, Pnglet.js, and is ``linked in'' via the HTML SCRIPT tag.)

Jan Nijtmans's Img is a free image-processing extension to the Tcl/Tk scripting language; it uses libpng and zlib for its PNG support. It works with Tcl 7.5 and Tk 4.1 and later versions[107] on both Unix/X and 32-bit Windows platforms. Both reading and writing are supported in versions 1.1.4 and 1.2b2, but a patch to Tk is required in order to write PNG images with an alpha channel. Version 1.2 is expected to be released just after the Tcl/Tk 8.1 release, currently scheduled for early May, 1999. Unfortunately, Scriptics was unwilling to incorporate Jan's Tk patch into the official 8.1 release (Tk 8.1 is thread-safe, but the patch is not), so manual patching will remain necessary for some time to come in order to write alpha PNGs.

[107] As of version 8.0, Tcl and Tk share the same version number.
Python Imaging Library

As its name suggests, Fredrik Lundh's Python Imaging Library (PIL) provides support for multiple image formats under the Python interpreted programming language on Unix or 32-bit Windows platforms. It can also support Tcl/Tk via the Tkinter package. Though currently still at a suspiciously low beta version (0.3b2), PIL supports both reading and writing PNG images, apparently including alpha channels and some 16-bit-per-sample images (possibly grayscale only). It also includes some support for MNG streams, though this has not been not updated since roughly draft 33. PIL may be freely used and distributed as long as such use is acknowledged.

Simon Clarke's PNGHandler provides read/write PNG support to the BeOS Translation Kit. It is freely available for both PowerPC and Intel platforms, and it requires BeOS version R3 or later. PNGHandler can read all PNG bit depths with the possible exception of 16-bit-per-sample images (e.g., 48-bit RGB), and it appears to have full alpha support. For writing, it supports only depths of 8, 24, and 32 bits. It appeared that PNGHandler may have been renamed to PNGTranslator as of version 1.20, but version 1.21 is once again called PNGHandler. Nevertheless, if the following link should break, check the PNG home site's Toolkits page, given at the beginning of this section, for updates.
SuperView Library

Andreas Kleinert's SuperView Library, part of his SViewII image application, provides read and write support for numerous image formats on the Amiga, in addition to a host of image-manipulation functions. It is not clear from the documentation whether it supports any of the more advanced PNG features such as gamma correction or even transparency. SViewII and the SuperView Library are shareware.

Last Update: 2010-Nov-26