from PIL import ImageFile as PILImageFile
p = PILImageFile.Parser()
#Parser the data
for chunk in content.chunks():
p.feed(chunk)
try:
image = p.close()
except IOError:
return None
#Here the model is RGBA
if image.mode != "RGB":
image = image.convert("RGB")
它总是卡在这里:
^{pr2}$
这是由于错误的close-within-PIL编码造成的,这是一个bug。在
编辑文件(系统上的路径可能不同):
sudo vi/usr/lib64/python2.6/site-packages/PIL/图像文件.py
在线283修改:
更改为:
^{pr2}$就这样,注释掉损坏的代码,添加正确的行,并保存文件。一切都完成了,只要运行以前失败的程序,它现在就可以工作了。在
相关问题 更多 >
编程相关推荐