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

Joerg Baumann Joerg.Baumann@stud.informatik.uni-erlangen.de
Wed, 18 Oct 2000 14:45:44 +0200 (MET DST)


On Wed, 18 Oct 2000, Torsten Gallmeister wrote:

> 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.
> 

the example:
  file = StringIO.StringIO()
  im.save(file, "JPEG")
  data = file.getvalue()
works for me (linux, Python 1.5.2, PIL 1.1)

Perhaps you have following problem:
  file = StringIO.StringIO()
  file is a write-only file-like-object

  file = StringIO.StringIO(data)
  file is a read-only file-like-object


  Joerg Baumann       joerg.baumann@stud.informatik.uni-erlangen.de
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+  
  Beware of bugs in the above code; I have only proved it correct, 
  not tried it.
                  Don Knuth