错误信息:
Traceback (most recent call last):
File "newbing.py", line 278, in <module>
main.main(path=path,filedate=filedate,log=log,bi=bi,fileutil=fileutil,im=im,root=root,month=nowmonth)
File "newbing.py", line 228, in main
im.formatImage(filepath,root+"small/"+month+"/"+filedate +"_small"+ imgpath)
File "/root/bingimages_py3test/src/newbingimages/UserTools.py", line 111, in formatImage
smallimg=img.resize((96,54),Image.ANTIALIAS)
File "/usr/local/python3.4/lib/python3.4/site-packages/Pillow-2.9.0-py3.4-linux-x86_64.egg/PIL/Image.py", line 1557, in resize
File "/usr/local/python3.4/lib/python3.4/site-packages/Pillow-2.9.0-py3.4-linux-x86_64.egg/PIL/ImageFile.py", line 250, in load
File "/usr/local/python3.4/lib/python3.4/site-packages/Pillow-2.9.0-py3.4-linux-x86_64.egg/PIL/ImageFile.py", line 59, in raise_ioerror
OSError: broken data stream when reading image file
源码:
class ImageUtils(object):
#Downsizing parameters according to the incoming documents to carry out image processing, under test.
def formatImage(self,filepathname,newfilesavepath):
img=Image.open(filepathname)
smallimg=img.resize((96,54))
f=FileUtils()
f.mkdir(newfilesavepath)
smallimg.save(newfilesavepath,"JPEG")
版本:
系统: CentOS release 6.6 (Final) x86_64
Python: 3.4.3
Python-Pillow版本: 2.9
已经执行过yum install libtiff-devel libjpeg-devel libzip-devel freetype-devel <br> lcms2-devel libwebp-devel tcl-devel tk-devel 了,把要缩放的图片下载到本地也是可以打开的.在线等,谢谢。
参看:http://my.oschina.net/cppblog/blog/500308
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。