[Image-SIG] PNG Support with Parsed images.
Roman Imankulov
roman at netangels.ru
Fri May 4 11:47:46 CEST 2007
Hi
Dennis Muhlestein wrote:
> 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.
>
> ....
>
> 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
>
I've got exactly same PNG bug with PIL 1.1.5 and 1.1.6. Does anybody
know any solution or workaround?
My sample session looks like this:
>>> import ImageFile
>>> p = ImageFile.Parser()
>>> fd = open('file.png')
>>> data = fd.read()
>>> fd.close()
>>> data
'\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x00\x01\x00\x00\x00\x01\x08\x03\x00\x00\x00(\xcb4\xbb\x00\x00\x00\x03PLTE\xff\xff\xff\xa7\xc4\x1b\xc8\x00\x00\x00\nIDAT\x08\x99c`\x00\x00\x00\x02\x00\x01\xf4qd\xa6\x00\x00\x00\x00IEND\xaeB`\x82'
>>> p.feed(data)
>>> im = p.close()
>>> im
<PngImagePlugin.PngImageFile instance at 0xa79efa6c>
>>> im.load()
Traceback (most recent call last):
File "<stdin>", line 1, in ?
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 298,
in read
data = self.data[pos:pos+bytes]
TypeError: unsubscriptable object
Thank you
--
roman at netangels.ru
More information about the Image-SIG
mailing list