jarun / imgp

:camera_flash: Fast batch image resizer and rotator
GNU General Public License v3.0
1.03k stars 50 forks source link

'PIL.Image.DecompressionBombError' when resizing large image #46

Closed aSemy closed 3 years ago

aSemy commented 3 years ago

I have a large 5.2MB image that I'd like to resize.

When I run imgp I get an error:

➜  imgp -x 50 i.png
Traceback (most recent call last):
  File "/home/linuxbrew/.linuxbrew/bin/imgp", line 676, in <module>
    main()
  File "/home/linuxbrew/.linuxbrew/bin/imgp", line 653, in main
    if resize_image(path):
  File "/home/linuxbrew/.linuxbrew/bin/imgp", line 223, in resize_image
    img = Image.open(src)
  File "/home/linuxbrew/.linuxbrew/Cellar/imgp/2.8/libexec/lib/python3.9/site-packages/PIL/Image.py", line 3009, in open
    im = _open_core(fp, filename, prefix, formats)
  File "/home/linuxbrew/.linuxbrew/Cellar/imgp/2.8/libexec/lib/python3.9/site-packages/PIL/Image.py", line 2996, in _open_core
    _decompression_bomb_check(im.size)
  File "/home/linuxbrew/.linuxbrew/Cellar/imgp/2.8/libexec/lib/python3.9/site-packages/PIL/Image.py", line 2905, in _decompression_bomb_check
    raise DecompressionBombError(
PIL.Image.DecompressionBombError: Image size (255553344 pixels) exceeds limit of 178956970 pixels, could be decompression bomb DOS attack.
jarun commented 3 years ago

Can you google and see if there's a solution?