Python module for PNG


All this thinking off about PNG files is because I have been modifying Johann C. Rocholl’s file to create…

but now it can cope with palettes, bit depths < 8, yadda yadda. Basically all PNG formats.

Download it from Google code. It even has documentation (as Python docstrings), and examples.

I would like to see this used for all your PNG needs in Python. So if it sucks, tell me!

PS: Dear lazyweb, where else should I announce this fine piece of hand-crafted software?

9 Responses to “Python module for PNG”

  1. Nick Barnes Says:


  2. Thomas Guest Says:

    Nice work! As a lazyuser, I’d be interested any advantages pypng has over PIL (which I currently use for most of my PNG needs).

  3. drj11 Says:

    @Thomas: Well for me, it has the advantage that I do not need to install PIL. Which I have tried to do in the past and failed. PyPNG is intended to be as simple as possible to install and deploy, hence pure Python.

  4. drj11 Says:

    @Nick: Ah yes, I actually did the pypi thing. Shortly after writing this article. Probably would not have bothered if distutils didn’t have a command to do it.

  5. drj11 Says:

    @Thomas: I have noted your concerns in Issue 9.

  6. I just added it as a comment to the 7th most “popular” issue for Google appengine. I.E. PIL being missing:

  7. Thomas Guest Says:

    @Drj11: Yes, I have found myself having to fiddle around to get PIL support for (e.g.) font rendering, but actually it too has pure Python support for PNGs. I’ll give pypng a try next time I’m poking around with PNGs.

  8. drj11 Says:

    @Pádraig: Ouch, isn’t reading app-engine issues painful? Lots of people want thumbnails. I suppose I would too. Obviously I am intending to write a resize engine in pure Python (as a sister to probably). But in pure Python it will be 200 to 1000 times slower than C (at a rough guess). Way too slow for production use.

  9. neil Says:

    Would love to see it running under PyS60…

Leave a Reply to drj11 Cancel reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: