how to return a StringIO of an Image

Fredrik Lundh fredrik at pythonware.com
Fri Nov 14 10:45:39 EST 2003


"Christoph" wrote:

>    image.save('test', 'JPEG')
>    image=StringIO(image.????()) # what's the right method?
>    return image
>
> Any hints? Thanx!

    file = StringIO()
    image.save(file, "JPEG")
    return file.getvalue()

</F>








More information about the Python-list mailing list