Question: I'm looking for a library to save an array of colour data to a PNG file. (That's all there is to it, right? I know very little about the internals of a PNG.)

This is for use in Nintendo DS development, so something lightweight is preferable. I don't need any other fancy features like rotation, etc.

Answer: 
To encode any kind of PNG file, libpng is the way of the walk.

However, on small devices like the DS you really want to store your image data in the format which the display hardware expects. It is technically possible to get libpng working on the platform, but it will add significant overhead, both in terms of loadtimes and footprint.
I managed to find a library that supports PNG (using libpng) and allows you to just give it raw image data.

It's called [LibPicture](http://www.dragonminded.com/?loc=ndsdev/LibPicture). It's a bit hefty though: ~1MB.