I have an array of RGB values that I use to draw an image on screen. I need to save that image to a png file.

I've looked at the usual candidates - libpng and the like, and they all seem to suffer from the usual Win32 multi-threaded non-threaded debug release problem. I'd really like to not have to bother with that problem.

So, I see that he CImage class can write png files. Ace. What I can't work out is how to load a CImage with RGB values from my ordinary array in order to write the output to a png file. Can anyone point me in the right direction?