imagepng() creates the PNG file in filename from the image image. The image argument is the return from the imagecreate() or imagecreatefrom* function.
The filename argument is optional, and if left off or filled with a NULL value, the raw image stream will be output directly.
See also imagegif(), imagewbmp(), imagejpeg(), imagetypes().