[Image-SIG] Problem with parsing PNG image

Christian Joergensen mail at razor.dk
Wed Nov 7 10:57:56 CET 2007


I'm having trouble parsing a PNG image. This snippet should show my problem:

from PIL import ImageFile
import StringIO
import urllib2
f = 
p = ImageFile.Parser()
im = p.close()
output = StringIO.StringIO()
im.save(output, format="image/png")

I keep getting:

   File "/usr/lib/python2.4/site-packages/PIL/ImageFile.py", line 298, 
in read
     data = self.data[pos:pos+bytes]
TypeError: unsubscriptable object

Am I doing something wrong?

Christian Joergensen | Linux, programming or web consultancy
http://www.razor.dk  |     Visit us at: http://www.gmta.info

More information about the Image-SIG mailing list