[Python-Dev] Add pure python PNG writer module to stdlib?

Johann C. Rocholl johann at rocholl.net
Sun Jun 11 00:28:11 CEST 2006


I'm working on simple module to write PNG image files in pure python.
Adding it to the standard library would be useful for people who want
to create images on web server installations without gd and imlib, or
on platforms where the netpbm tools are not easily available.

Does anybody find this idea interesting?
Does anybody think it could go into stdlib before the feature freeze for 2.5?

The module consists of only one file. It imports only sys, zlib,
struct (maybe re for testing).
Some benchmarks for comparison with the pnmtopng program (from
netpbm), encoding a plain RGB file with 24 bits per pixel, input file
size 11520017 bytes (11M), measured with the 'time' command, including
Python interpreter start-up:
                        pnmtopng        png.py
straight encoding       1.31 seconds    0.72 seconds
resulting file size     342953 bytes    292885 bytes
interlaced encoding     3.78 seconds    4.88 seconds
resulting file size     422441 bytes    346872 bytes

The source code of the module lives here:
http://svn.browsershots.org/trunk/shotfactory/lib/image/png.py
http://trac.browsershots.org/browser/trunk/shotfactory/lib/image/png.py

I am willing to maintain the module for 5+ years, as it is a small but
important part of my main project. I am also willing to write latex
documentation and tests for the module, and I think I could do that
within the next three days. The module is licensed under the Apache
License 2.0, and I am ready to sign a contributor agreement for the
PSF.

I will probably add support for more different PNG formats, especially
alpha channel transparency, and then maybe color palettes. I don't
plan to add PNG decoding because it would make the module much larger
and rather complex.

Sorry if this contribution seems brash. Perhaps it is easy enough to
download and deploy my module separately. But I thought that if there
is a chance to get it in before beta1, I should not hesitate and just
ask.

Cheers,
Johann


More information about the Python-Dev mailing list