Last week I mentioned that I created a library for encoding GIFs. Well, over the past week I've been a busy little beaver creating two new libraries: one is a generic zlib encoding library and one is a PNG writer that sits on top of the zlib stuff. Like before, there is a silly demo. It takes about 0.017 seconds to render all four corner PNGs. Also, they have an alpha channel for even easier blending.
To make PNG and zlib play nice together, the zlib stuff takes a user-supplied octet array and bounding indexes and raises a continuable error when that array is full. So you can chunk things up incrementally instead of needing all the input available at once.
(And, like the GIF library, all pieces involved are pure Common Lisp; no FFI to zlib or libpng anywhere.)