error:
Traceback (most recent call last):
File “newbing.py”, line 278, in
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
source code:
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”)
version:
os: CentOS release 6.6 (Final) x86_64
Python: 3.4.3
Python-Pillow: 2.9
Already installed libjpeg,Help me, thank you,I will be the original images are downloaded to the local, can open normally.