Closed nadzhou closed 3 years ago
You can change this behaviour from outside of Pillow like so
from PIL import Image
Image.MAX_IMAGE_PIXELS = 2000000000
This functionality is documented at https://pillow.readthedocs.io/en/stable/reference/Image.html#PIL.Image.open -
To protect against potential DOS attacks caused by “decompression bombs” (i.e. malicious files which decompress into a huge amount of data and are designed to crash or cause disruption by using up a lot of memory), Pillow will issue a DecompressionBombWarning if the number of pixels in an image is over a certain limit, PIL.Image.MAX_IMAGE_PIXELS.
This threshold can be changed by setting PIL.Image.MAX_IMAGE_PIXELS. It can be disabled by setting Image.MAX_IMAGE_PIXELS = None.
If desired, the warning can be turned into an error with warnings.simplefilter('error', Image.DecompressionBombWarning) or suppressed entirely with warnings.simplefilter('ignore', Image.DecompressionBombWarning). See also the logging documentation to have warnings output to the logging facility instead of stderr.
If the number of pixels is greater than twice PIL.Image.MAX_IMAGE_PIXELS, then a DecompressionBombError will be raised instead.
oh ok @radarhere you can close the issue.
i was actually using another repo and came across this problem.
Expand the number of MBs for the image input. I deal with pictures that are more than 90 MB per picture. Here's the total error that I get: