I believe I have found a bug with PIL. It can be illustrated by the
following code:
from PIL import Image, ImageFile
path = <path to a valid png file>
file = open(path, 'rb')
p = ImageFile.Parser()
p.feed(file.read())
img = p.close()
file.close()
img.thumbnail((380, 380), Image.ANTIALIAS)
img.save(<path in an existing directory>)
- this works fine it the path is not to a png but to a jpg or gif, but
given that is points to a (valid) png it chucks the following error:
Traceback (most recent call last):
File "piltest.py", line 12, in <module>
img.save('C:/Documents and Settings/gareth0/Desktop/thumb.png')
File "C:\Python25\Lib\site-packages\PIL\Image.py", line 1372, in save
self.load()
File "C:\Python25\Lib\site-packages\PIL\ImageFile.py", line 189, in load
s = read(self.decodermaxblock)
File "C:\Python25\Lib\site-packages\PIL\PngImagePlugin.py", line 365,
in load_read
return self.fp.read(bytes)
File "C:\Python25\Lib\site-packages\PIL\ImageFile.py", line 300, in read
data = self.data[pos:pos+bytes]
TypeError: 'NoneType' object is unsubscriptable
- i hope someone can help me out here, this has been driving me insane,
thanks!
_______________________________________________
Image-SIG maillist - Image-SIG@python.org
http://mail.python.org/mailman/listinfo/image-sig