python save保存图片系统提示错误请帮忙分析python源码,savepython,很基本的操作,比如imp
python save保存图片系统提示错误请帮忙分析python源码,savepython,很基本的操作,比如imp
很基本的操作,比如
import Imageim = Image.open('male.png')im.save('test.png')
就能出错,报错信息是这样的:
Traceback (most recent call last):
File "
File "/usr/local/lib/python2.7/dist-packages/PIL/Image.py", line 1439, in save
save_handler(self, fp, filename)
File "/usr/local/lib/python2.7/dist-packages/PIL/PngImagePlugin.py", line 572, in _save
ImageFile._save(im, _idat(fp, chunk), [("zip", (0,0)+im.size, 0, rawmode)])
File "/usr/local/lib/python2.7/dist-packages/PIL/ImageFile.py", line 481, in _save
e = Image._getencoder(im.mode, e, a, im.encoderconfig)
File "/usr/local/lib/python2.7/dist-packages/PIL/Image.py", line 399, in _getencoder
return apply(encoder, (mode,) + args + extra)
但是
im.show()
是可以看到图片的。
搜了好久都没搜到类似的问题...
刚提问就搜到答案了!
参考:http://stackoverflow.com/questions/17451711/typeerror-when-resizing-an-image-with-pil-in-python/17451810#17451810
改变一下导入方式就能解决这个问题了
from PIL import Image
感谢万能的栈爆网!XD
编橙之家文章,
相关内容
- Python 邮件发送Flask-Mail不成功原因,pythonflask-mail,Flask
- 请问Python multiprocessing使用困惑求解,,自己在做一个p
- Redis存储带时间戳分类实时数据问题求教,redis实时数据
- Python类似java jstack命令的功能是什么,pythonjstack,最近有
- Python源码分析快排统计次数时if是否要算入计数中,p
- Python用requests和BeautifulSoup抓取信息失败请大神指导,
- Python gevent与bottle有哪些要避免的坑,pythongevent,目前发
- Python stmplib库邮件发送情况反馈怎么实现,pythonstmplib
- Flask判断是当前页面的简单写法是什么,flask当前页,现
- python支持两个应用程序同时启动吗?,python应用程序,i
评论关闭