(一)
使用PIL和Pillow处理图片时,出现如下错误:
IOError: broken data stream when reading image file
错误的原因有可能是:
1.import tf和import PIL的顺序有问题
2.图片本身受损
第一种解决方法:调换顺序即可。
第二种解决方法如下:
from PIL import Image, ImageFile
ImageFile.LOAD_TRUNCATED_IMAGES = True
(二)
打开文件,进行写操作,报错 OSError: [Errno 29] Illegal seek
f = open(save_file_dir,'a')
OSError: [Errno 29] Illegal seek
经过检查发现是因为save_file_dir的类型不对,正确应该是string类型
原文地址为https://blog.csdn.net/fengzhongluoleidehua/article/details/85949173