问题描述
原因
图片过大,超过178956970 像素。
解决方案
- 图像缩放处理
对读入图像尺寸进行判断,超过178956970 像素的图像进行缩放处理。 - 修改最大像素值。
from PIL import ImageFile
ImageFile.LOAD_TRUNCATED_IMAGES = True
Image.MAX_IMAGE_PIXELS = None
参考资料
解决Pillow报错 Image size (XXX pixels) exceeds limit of 178956970 pixels, could be decompression