For reference, here's the discussion from the last time Diliup asked this same question, a month ago:
https://groups.google.com/forum/#!topic/pygame-mirror-on-google-groups/WIuIlmXvqowOn Tue, Sep 9, 2014 at 7:57 AM, diliup gabadamudalige <diliupg@xxxxxxxxx> wrote:How can a Pygame surface be converted to an image file say a jpeg or a png WITHOUT writing the file to disk? Say after a screen grab?