Pillow 报错信息,如:
File "/usr/local/lib/python3.7/dist-packages/PIL/Image.py", line 2828, in _decompression_bomb_check
"could be decompression bomb DOS attack." % (pixels, 2 * MAX_IMAGE_PIXELS)
PIL.Image.DecompressionBombError: Image size (498594450 pixels) exceeds limit of 178956970 pixels, could be decompression bomb DOS attack.
报错原因:图片过大,像素数超过 178956970.
解决方案:
from PIL import ImageFile
ImageFile.LOAD_TRUNCATED_IMAGES = True
Image.MAX_IMAGE_PIXELS = None