The PNG format will accept either greyscale or RGB pixmaps, with or without alpha. As a special case, alpha only pixmaps are accepted and written as greyscale.
Because PNG is such a useful and widely used format, we have another couple of functions. These take either a fz_image or a fz_pixmap and produce a fz_buffer containing a PNG encoded version. This is very useful when converting between document formats as we can frequently use a PNG version of an image as a replacement for other image formats that may not be supported.