我用 PIL 打开了一张图片,但是当我尝试用它split()
来分割频道时,我得到了以下错误:
AttributeError: 'NoneType' object has no attribute 'bands'
import Image
img = Image.open('IMG_0007.jpg')
img.split()
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
/home/blum/<ipython console> in <module>()
/usr/lib/python2.6/dist-packages/PIL/Image.pyc in split(self)
1495 "Split image into bands"
1496
-> 1497 if self.im.bands == 1:
1498 ims = [self.copy()]
1499 else:
AttributeError: 'NoneType' object has no attribute 'bands'