BUG:16-bit grayscale TIFF images fail thumbnail generation and are silently skipped during indexing
Maintainers usually reply within 4 days
@Krishna081207 is already working on this.
Since Nov 26, 2026.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 55/100
Research direction
Start by tracing TIFF thumbnail generation and the Pillow/SigLIP loader under backend/app/utils and the model preprocessing paths; the issue does not name specific files or tests. Compare how each path handles a synthetic I;16 TIFF, then check indexing and model inputs after normalization. Done means indexing creates a thumbnail and database record, and YOLO, FaceNet, and SigLIP receive consistent 8-bit RGB inputs.
Written by the indexing model from the issue text.
Description
Is there an existing issue for this?
- I have searched the existing issues
What happened?
PictoPy added TIFF support in #1532, and standard 8-bit/CMYK TIFFs generate thumbnails and index normally. However, 16-bit grayscale TIFFs (I;16) fail during thumbnail generation with:
OSError: cannot write mode I;16 as JPEG
Because thumbnail generation fails, normal folder indexing silently skips the image without inserting a DB record or queuing it for AI processing.
Additionally, if a 16-bit grayscale TIFF is passed directly to the model loaders, the two decoding paths behave inconsistently:
OpenCV (YOLO / FaceNet) downscales it to mid-gray.
Pillow (SigLIP) clips 16-bit pixel values (> 255) to pure white (255) on .convert("RGB").
Steps to Reproduce
Place a 16-bit grayscale .tiff (Pillow mode I;16) in a tracked folder.
Run folder indexing / thumbnail generation.
Observe OSError: cannot write mode I;16 as JPEG and note that no record is inserted into the database.
Pass the same file directly into the OpenCV (YOLO/FaceNet) and Pillow (SigLIP) preprocessing paths and compare the resulting RGB arrays.
Expected Behavior
16-bit grayscale TIFFs (I;16) should be downscaled to 8-bit (uint8, 0–255) before JPEG thumbnail creation and before passing to Pillow/SigLIP.
Normal folder indexing should successfully generate thumbnails, insert the image record, and produce consistent 8-bit RGB inputs across YOLO, FaceNet, and SigLIP.
Suggested Fix
Add a shared 16-bit-safe Pillow normalization helper in backend/app/utils/ (e.g., scaling I;16 down to 8-bit via img.point(lambda i: i >> 8).convert("L").convert("RGB") or NumPy (arr >> 8).astype(np.uint8) before JPEG save / RGB conversion).
Use it in both thumbnail generation and the SigLIP Pillow loader so OpenCV and Pillow paths produce consistent 8-bit RGB images.
Add pytest regression tests using a synthetic I;16 TIFF fixture covering thumbnail generation, indexing, and model input normalization.
Environment
Branch: dev
OS: Windows
Related: #1646, #1532
Record
- I agree to follow this project's Code of Conduct
- Dominant language
- Python
- Stars
- 322
- Forks
- 793
- Avg merge
- 6d 9h
- Merged PRs (30d)
- 20
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from AOSSIE-Org/PictoPy
-
BUG: Semantic search sees portrait phone photos sideways (SigLIP ignores EXIF orientation)Possibly taken @jayssSmm claimed this 1 day ago. Openbug enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
AOSSIE-Org/PictoPy#1780 · 5 comments ·
Maintainers usually reply within 4 days
-
BUG: Share password loses leading/trailing spaces so the password you set doesn't workPossibly taken @swastiksharma45 claimed this 2 days ago. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
AOSSIE-Org/PictoPy#1779 · 2 comments ·
Maintainers usually reply within 4 days
-
BUG: PROD: Face search shows "No Matches Found" for every empty result, even when AI tagging is offPossibly taken @dhruvbit claimed this 3 days ago. Openbug enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
AOSSIE-Org/PictoPy#1770 · 3 comments ·
Maintainers usually reply within 4 days
-
BUG: Add images to album: success message shows requested count, not number actually addedPossibly taken @riyanshbhosale claimed this 5 days ago. Openbug enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
AOSSIE-Org/PictoPy#1740 · 4 comments ·
Maintainers usually reply within 4 days
-
BUG: /sync-folder does not validate the supplied folder_idMay be free again @sathvikn113 claimed this 10 days ago, and no pull request is open. Openbug possible-duplicate
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
AOSSIE-Org/PictoPy#1731 · 5 comments ·
Maintainers usually reply within 4 days
All issues in AOSSIE-Org/PictoPy
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
bad-antics/lateralus-lang#1140 ·
Maintainers usually reply within 4 days
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 3 days
-
fixture good first issue help wanted vendor:cisco
Difficulty 1/5 1-3 hours Newbie friendliness 85/100