[Image-SIG] PNG Support with Parsed images.

Dennis Muhlestein djmuhlestein at gmail.com
Tue Jan 2 21:42:39 CET 2007


If I load a png file with Image.open, I can manipulate it, save it
etc.  If I however use ImageFile.Parser(), I can read the size, format
and any info, but I can't show or manipulate the image in any way.

I get this exception on any of the requested methods:

Here is what I'm typing:

>>> import ImageFile
>>> f=open('somefile.png')
>>> p=ImageFile.Parser()
>>> p.feed(f.read())
>>> i=p.close()
>>> i.show()
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/usr/lib/python2.4/site-packages/PIL/Image.py", line 1449, in show
    _showxv(self, title, command)
  File "/usr/lib/python2.4/site-packages/PIL/Image.py", line 2082, in _showxv
    file = image._dump(format=format)
  File "/usr/lib/python2.4/site-packages/PIL/Image.py", line 476, in _dump
    self.load()
  File "/usr/lib/python2.4/site-packages/PIL/ImageFile.py", line 189, in load
    s = read(self.decodermaxblock)
  File "/usr/lib/python2.4/site-packages/PIL/PngImagePlugin.py", line
365, in load_read
    return self.fp.read(bytes)
  File "/usr/lib/python2.4/site-packages/PIL/ImageFile.py", line 300, in read
    data = self.data[pos:pos+bytes]
TypeError: unsubscriptable object


This is with version 1.1.6.  I double checked 1.1.5 and got the same thing.

This works fine with a JPEG image.  The PNG support appears to have a
bug to me, but perhaps I'm missing something.

Thanks
Dennis


More information about the Image-SIG mailing list