[Zope] PIL: convert an image-object back to file object

Christoph Landwehr chris-zopemailing at gmx.de
Fri Nov 14 11:33:29 EST 2003


Christoph Landwehr schrieb:

> Somehow I seem to pass the wong data to StringIO:
> 
> image=StringIO(my_PIL_image.tostring())
> Is the PIL Image method tostring() the right choice?

I found the solution (thanx to Fredrik Lundh) :

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

Regards
Christoph




More information about the Zope mailing list