how to return a StringIO of an Image

Bengt Richter bokr at oz.net
Fri Nov 14 15:31:51 EST 2003


On Fri, 14 Nov 2003 16:45:39 +0100, "Fredrik Lundh" <fredrik at pythonware.com> wrote:

>"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()
>
You are recommending shadowing 'file' ?!

Regards,
Bengt Richter




More information about the Python-list mailing list