I have a background jpg image on disk on which I want to superimpose a php-generated png image. Unfortunately, GD's `imagepng()` function outputs the data directly, so I can't store it in a variable to copy it using `imagecopy()` or `imagecopymerge()`.

I want a function that generates the png, which I can use with one of the `imagecopy()` functions, but I don't know how to return the generated png.

Is there a way to do this without writing the generated image to disk?
Thanks.
Ray