[Image-SIG] create image-instances from data strings

Torsten Gallmeister galle@rostock.zgdv.de
Wed, 18 Oct 2000 14:34:53 +0200


Cool, that works but only for the open method. Image.save(file) and getting
values with file.getvalue() gives me the initial data of der StringIO
object.Image.save("filename") makes the correct/changed imagefile.
do you know what's  happen?

Torsten.


> sure: just wrap the data in a StringIO object, and use
> Image.open() on that object:
>
>     file = StringIO.StringIO(data)
>     image = Image.open(file)
>
> saving to a string is as easy (cf. the recent "Image.tostring" thread)
>
>     file = StringIO.StringIO()
>     im.save(file, "JPEG")
>     data = file.getvalue()
>
> </F>