This is the home of png++, a C++ wrapper for libpng library.
PNG++ aims to provide simple yet powerful C++ interface to libpng, the PNG reference implementation library.
PNG++ is free software distributed under a modified variant of the BSD license.
Using raw libpng in C++ may impose serious challenge since lots of precautions must be taken to handle initialization/deinitialization of control structures as well as handling errors correctly. With png++ you can read or write PNG images just in a single line of C++ code:
png::image< png::rgb_pixel > image("input.png"); image.write("output.png");
The code reads an image from the file named
then writes the image to a file named
this example png++ does all the transformations needed to create
adequate in-memory RGB representation of the image (well, in most
cases it simply instructs libpng to do so).
The image in
"input.png" can be RGB image, or it might be
grayscale or even indexed image with a palette -- png++ will just
convert any input to RGB format. However, for technical reasons such
automatic transformation is supported for RGB and Grayscale color
types only. Optionally there may be an alpha channel in the target
color space (RGBA and Gray+Alpha respectively).
You can grab the latest version here.
Or point your Subversion client
svn://svn.sv.nongnu.org/pngpp/trunk/ to get the current
development version (not necessarily usable, tough). The SVN repository is
also accessible through HTTP protocol:
Online documentation is available here: docs.
Lacks support for output transformations.
Lacks support for optional/unknown chunks in PNG data stream.
To report bugs, please use
Do not forget to check if the bug was already filed.
Interested? Then help by improving code, documentation or whatever could be
improved about it.
For more information on how to participate visit png++ development site at Savannah.
There is a mailing list for developers. You can also contact me by dropping a mail to firstname.lastname@example.org.
Copyright © 2007, 2008, 2010, 2015, 2019. Alex Shulgin