-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Large BMP files crash (i.e. more than 2**32 pixels) #4274
Comments
Pillow Version: 6.2.1 |
Looks like BMP max filesize is limited to 4GiB. The second field in BMF file header is filesize in bytes, which is 4 bytes int, which can not exceed 2^32 (4GiB). Since your image is 1bpp image, with given dimensions image size would have to be 7,641,879,368 bytes, which exceeds 4 byte int capacity. |
Thanks for the clarification, can we get this notice added to the code during the |
Thanks @kkopachev for figuring this one out. I've created PR #4283 to throw a clearer error. |
I started asking on StackOverflow about my original problem, and the code is pasted over there:
https://stackoverflow.com/questions/59353721/python-pillow-opening-1-bit-depth-files-with-8-bits
but after moving to a larger machine (256 GB RAM) I moved on from the original issue and onto an Exception in the code.
Basically I'm trying to save a 59GigaPixel single-channel (1 bit depth) BMP file, which is yielding this error:
Here's a small example to reproduce easily (requires at least 61GB of RAM, or RAM+swap):
What are your OS, Python and Pillow versions?
The text was updated successfully, but these errors were encountered: