[Image-SIG] PIL 1.1.5 - seek(0) on StringIO file object

Martin Aherron tapenet at cox.net
Fri Apr 1 06:14:15 CEST 2005

This is in the online docs for the PIL
Reading from a string 

import StringIO

im = Image.open(StringIO.StringIO(buffer))

Note that the library rewinds the file (using seek(0)) before reading the image header.

I just downloaded Version 1.1.5 and found that the library is not doing the seek before reading from the StringIO object.

Adding a seek(0) just prior to an Image.open fixed the problem.

More information about the Image-SIG mailing list