您的位置:首页 > 移动开发 > Objective-C

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

2015-11-05 10:30 585 查看
解决方法: 把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)


 [/code]
                                            
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: