Hi, Image.split appears to be broken when the image file isn't loaded first.
My testcase is:
>>> from PIL import Image
>>> x = Image.open('test.png')
>>> x.split()
[..]
AttributeError: 'NoneType' object has no attribute 'bands'
I think Image.point was broken in the same way recently; the client
workaround of calling Image.load works here too.
Patch attached.
Regards,
--
,''`.
: :' : Chris Lamb
`. `'` [email protected]
`-
diff -urNad python-imaging-1.1.7.orig/PIL/Image.py python-imaging-1.1.7/PIL/Image.py
--- python-imaging-1.1.7.orig/PIL/Image.py 2009-12-09 14:37:37.000000000 +0000
+++ python-imaging-1.1.7/PIL/Image.py 2009-12-09 14:38:13.000000000 +0000
@@ -1494,11 +1494,12 @@
def split(self):
"Split image into bands"
+ self.load()
+
if self.im.bands == 1:
ims = [self.copy()]
else:
ims = []
- self.load()
for i in range(self.im.bands):
ims.append(self._new(self.im.getband(i)))
return tuple(ims)
signature.asc
Description: PGP signature
_______________________________________________ Image-SIG maillist - [email protected] http://mail.python.org/mailman/listinfo/image-sig
