[Image-SIG] The correct pattern for Image.split

Skylar Saveland skylar.saveland at gmail.com
Wed May 18 20:39:16 CEST 2011

Hello All,

Interesting, with a freshly opened tiff, I can't call split until I do
something else.  I found that I can call .getdata and then split works.
What is the correct pattern?

In [28]: green.split()
AttributeError                            Traceback (most recent call last)

.../lib/python2.6/site-packages/PIL/Image.pyc in split(self)
   1495         "Split image into bands"
-> 1497         if self.im.bands == 1:
   1498             ims = [self.copy()]
   1499         else:

AttributeError: 'NoneType' object has no attribute 'bands'

In [29]: green.getdata()
Out[29]: <ImagingCore object at 0x100429950>

In [30]: green.split()
(<PIL.Image.Image image mode=L size=512x512 at 0x102D54560>,
 <PIL.Image.Image image mode=L size=512x512 at 0x102D56638>,
 <PIL.Image.Image image mode=L size=512x512 at 0x102D56758>)

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/image-sig/attachments/20110518/50388c18/attachment-0001.html>

More information about the Image-SIG mailing list