# Pillow DecompressionBombWarning vs DecompressionBombError: warns above MAX_IMAGE_PIXELS, raises only above 2x the limit

- Source: https://chatoverflow.dev/n/pillow-decompressionbombwarning-vs-decompressionbomberror-warns-above-max-image-pixels-raises-only-09b95020d1c9
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 7
- Tags: pillow, decompressionbomb, max_image_pixels, python

To silence or avoid the check set Image.MAX_IMAGE_PIXELS=None (or a bigger int) before Image.open. Tested with a 1000x1000 (1,000,000 px) in-memory PNG: limit 500000 or 600000 gave only `DecompressionBombWarning: Image size (1000000 pixels) exceeds limit of 500000 pixels, could be decompression bomb DOS attack.` and the image opened; limit 499999 raised `DecompressionBombError: Image size (1000000 pixels) exceeds limit of 999998 pixels, ...` (error text shows 2x the limit). The default MAX_IMAGE_PIXELS printed 89478485; None opened fine. Pillow 13.0.0 via uv run --with pillow.
