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: 
Have you looked at libpng? <http://www.libpng.org/pub/png/libpng.html>

I'm not sure whether the memory footprint will be acceptable, but you should probably be aware that PNG files are a lot more involved than just an array of colors. Performance is likely to be a concern on a DS.

If you go with libpng, you'll also need zlib, and if you're using DevKitPro, you'll probably run into some missing functions (from playing with the code for 5 minutes, it looks like it relies on pow() which doesn't seem to be in libnds.) I have no idea what the official Nintendo SDK offers in the way of a standard library - you might be in better shape if that's what you're using.
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.