Skip to content

fix: apply percentile contrast stretch for 16-bit TIFF previews#99

Merged
jat255 merged 2 commits intomainfrom
fix/image-preview-16bit
Apr 1, 2026
Merged

fix: apply percentile contrast stretch for 16-bit TIFF previews#99
jat255 merged 2 commits intomainfrom
fix/image-preview-16bit

Conversation

@jat255
Copy link
Copy Markdown
Contributor

@jat255 jat255 commented Mar 31, 2026

Summary

  • Detects 16-bit TIFF modes ("I", "I;16", "I;16B")
  • Applies 2nd-98th percentile contrast stretch and converts to 8-bit before generating thumbnail
  • Fixes blank/near-blank previews for scientific images like ECCI patterns

Test plan

  • uv run pytest --mpl --mpl-baseline-path=tests/files/figs tests/unit/test_extractors/

@jat255 jat255 force-pushed the fix/image-preview-16bit branch from 6f3c761 to ab62ade Compare March 31, 2026 04:40
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 31, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 31, 2026

📚 Documentation Preview

The documentation for this PR has been deployed to:

This preview will be updated on each push to this PR.

@jat255 jat255 force-pushed the fix/image-preview-16bit branch 2 times, most recently from d9c2286 to a772590 Compare April 1, 2026 02:26
jat255 added 2 commits March 31, 2026 22:21
16-bit scientific images (e.g. ECCI patterns) produce blank or near-blank
previews when naively downscaled to 8-bit. Adds contrast stretching using
the 2nd-98th percentile range to normalize the output image.
@jat255 jat255 force-pushed the fix/image-preview-16bit branch from a772590 to 846f462 Compare April 1, 2026 04:21
@jat255 jat255 merged commit 23744bb into main Apr 1, 2026
20 checks passed
@jat255 jat255 deleted the fix/image-preview-16bit branch April 1, 2026 04:39
github-actions bot added a commit that referenced this pull request Apr 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant