BUG: Photos larger than ~179 megapixels are silently skipped during import
Is there an existing issue for this?
- [x] I have searched the existing issues
What happened?
Pillow refuses to open any image over 178,956,970 pixels (twice its default MAX_IMAGE_PIXELS) and raises DecompressionBombError. PictoPy never changes that limit, and image_util_is_valid_image() in backend/app/utils/images.py catches every exception and returns False, so these files are dropped from the library with no log message.
That limit is within reach of ordinary cameras: 200 MP phone modes produce 16320 × 12240 (199.7 MP) images, and stitched or drone panoramas regularly exceed it.
Reproduce: put a 30000 × 6000 JPEG (180 MP) and a normal 4000 × 3000 JPEG in a folder and add it. The folder reports 1 image; only the normal photo is indexed and nothing is logged about the other one.
Replacing the validity check alone isn't enough: image_util_generate_thumbnail() and image_util_extract_metadata() hit the same error on that file (thumbnail fails, metadata comes back 0 × 0).
Proposed fix: set an explicit, higher pixel limit in one place, decode JPEG thumbnails with Image.draft() so large files stay cheap to process, and log a warning whenever a file is skipped for size. I can work on this.
Record
- [x] I agree to follow this project's Code of Conduct
👋 Thanks for opening this issue! The maintainers will review it shortly. Till then, do not open any PR. This is a strict rule we like to follow around here :)
@rohan-pandeyy, could you please check this backend issue and confirm whether it is a bug or an intentional restriction?
⚠️ Potential Duplicate Issue (Semantic Match)
This issue appears semantically similar to the following issues in AOSSIE-Org/PictoPy:
-
Performance: image_util_is_valid_image opens every image with PIL during folder scan, causing O(n) full reads on large libraries (#1409, open) https://github.com/AOSSIE-Org/PictoPy/issues/1409 Similarity: 69%
-
BUG: Thumbnail Generation Silently Fails for Certain PNG Modes (#1513, open) https://github.com/AOSSIE-Org/PictoPy/issues/1513 Similarity: 65.6%
-
BUG: iPhone/mobile images (.heic, .heif, .avif) are silently skipped and unsupported during folder import (#1576, open) https://github.com/AOSSIE-Org/PictoPy/issues/1576 Similarity: 63.5%
Please review before proceeding.
Link your account with Gitcord
Thanks for opening this issue, @Saurabhyadav0!
To receive Discord notifications and contributor tracking for this organization:
- Join Discord: https://discord.gg/hjUhu33uAn
- In Discord, run
/link Saurabhyadav0 - Paste the verification code into your GitHub bio (or a public gist)
- Click Verify in Discord (or run
/verify-link Saurabhyadav0)
Once linked, Gitcord can notify you about assignments, mentions, and more.
— Posted by Gitcord
Thanks for taking the time to investigate this and for providing a detailed reproduction scenario @Saurabhyadav0.
While I understand the concern, we don’t consider supporting images of this size a priority at the moment. Raising Pillow’s pixel limit also introduces additional considerations around memory consumption and processing performance, particularly for users with limited system resources.
For now, we’ll be keeping the existing behavior unchanged. We appreciate the offer to work on a fix, but we’ll pass on this for the time being.
Thanks again for your interest in improving PictoPy!