ENH Support saving 16 bit PNG images

The only tricky bit is saving in the right endiness. For supporting
this, this commit also adds a memory pool object which frees the whole
pool when its destructor is called.