PIL中分离通道发生“AttributeError: 'NoneType' object has no attribute 'bands'”

解决方法:
这个貌似是属于一个bug
把Image.py中的1500行左右的split函数改成如下即可:

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)
posted @ 2015-01-16 14:49  mrbean  阅读(1215)  评论(0编辑  收藏  举报