I recently encountered the following error while trying to manipulate a rather large image of
71752×11072 with the fantastic split image tool:
PIL.Image.DecompressionBombError: Image size (794438144 pixels) exceeds limit of 178956970 pixels, could be decompression bomb DOS attack.
The Pillow python package appears to include a fairly useful feature to prevent DDOSing by uploading huge images to a server in quick succession.
If you need to manipulate extremely large dimension images you can disable (or increase) this check within your python script after your `import PIL` line.
To disable the check simply add the following:
PIL.Image.MAX_IMAGE_PIXELS = None
To increase the check by double the current limit for example, simply add the following:
PIL.Image.MAX_IMAGE_PIXELS = 357913940
In my case, the image I'm manipulating is ~4.5x greater than the limit so I chose to disable the check. I am only using this locally anyway, not in a production environment.