fix(raster): open low-bit scans in black and white #3623
All Vouch review confidence checks passed
Residual risk 0.23 = Change Risk (0.43) × (1 − Review Confidence (0.47)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.43 · 381 lines diff across 4 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.356
Shallow Review Depth
shallow_review_depth
0.344
Real PR Conversation Timeline
1 comments
"Review active on #3623"
general
weight: 0.35
github-actions[bot]
Summary
A 1-bit GeoTIFF scan currently opens with two class colours because its few integer values select Unique Values. Open single-band grey GeoTIFFs with 1, 2 or 4 bits per sample as a grey MinMax stretch instead; at 1 bit, 0 draws black and 1 white. MinIsWhite reverses that through the existing normalizer.
The rule uses file bit depth, so a 0/1 raster created in a session still defaults to categories. Palette files keep their colour table. MinMax derives bounds from the pixels instead of storing fixed custom bounds, avoiding a stored-value warning when reopening a saved MinIsWhite layer.
Whole-file, local window and COG reads retain the bit depth, including world-file rotation. Desktop, browser, CLI, Python and phone share the default style path. Existing add-data commands reach it from the ribbon, command search, Assistant, MCP and plugins; no command parameter or tool description changes. Layers can still be restyled, removed and reopened through existing commands, with existing undo behavior. Saved styles retain their explicit renderer.
Memory adds one
Option<u8>per raster and per COG layout; no pixel buffer or layer copy is added. No dependency, project-format, command or plugin-interface change. This is additive file metadata supporting a default-display bug fix.Testing
cargo test -p rustgis-data -p rustgis-map -p rustgis-tiles --lib: 2,129 data, 683 map and 612 tiles tests passed (11 existing data tests ignored).a_window_of_a_geotiff_in_strips_comes_in_as_a_rasteranda_cog_window_comes_in_as_a_rasterpassed.cargo fmt --all --check, private contribution preflight and publication hooks passed.05375b1411878cd74266a097f3c869ef1fd0b573: https://github.com/Mavrick-F/RustGIS/actions/runs/46938925389.stream:trueexports of the georeferenced 1-bit sample are pixel-identical.UI evidence
The same synthetic georeferenced 1-bit GeoTIFF exported through
rustgis-cli. Before is reproduced by explicitly selecting the previous Unique Values/Harbour style in the changed build; after uses the default on opening the file.!Before: previous Unique Values style
!After: default black and white
Related issue
Relates to #2761.
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
<!-- coderabbit-ai-generated:v1 -->
Summary by CodeRabbit
New Features
Single-band grayscale images with 1-, 2-, or 4-bit samples now receive a default contrast stretch for clearer display.
* Grayscale rendering respects images where zero represents white; palette-based images retain their existing rendering behavior.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->