Repository navigation
feat(color): area sampling and colour preview for the white balance picker - #1832
Merged
CyberTimon merged 5 commits intoOct 5, 2026
Merged
Conversation
lalibertemarc
force-pushed
the
feature/wb-picker-sample-area
branch
from
October 4, 2026 12:58
b82c2c0 to
3c5d279
Compare
Click averages a square under the cursor, click-drag averages a rectangle. Sampling moves to a new sample_white_balance Tauri command that reads the linear original image and maps the selection through rotation, flip, orientation, crop and perspective, instead of reading the stale medium thumbnail JPEG. While hovering, a swatch shows the averaged colour, its RGB values and the resulting temperature/tint. Refs CyberTimon#1251, CyberTimon#747 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Reuse srgb_channel_to_linear in apply_srgb_to_linear instead of keeping a second copy of the curve, and draw the hover square and drag box with one WbSampleOutline component. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The area sampler now turns its averaged linear RGB into an absolute white balance with white_balance::pick_white_balance, using the loaded image's as-shot white balance, since the original image is rendered at as-shot. The pick is written in the active white balance mode (Kelvin or relative), and the hover swatch shows the values in that mode too. pick_white_balance is no longer called from the frontend, so it is a plain function again and the pick_white_balance command and invoke are removed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
lalibertemarc
force-pushed
the
feature/wb-picker-sample-area
branch
from
October 4, 2026 20:25
3c5d279 to
e4d6fd1
Compare
lalibertemarc
added a commit
to lalibertemarc/RapidRAW
that referenced
this pull request
Oct 4, 2026
Brings in the rebased CyberTimon#1832: swatch label fix, shared sRGB decode and sample outline, and the mode-aware swatch readout. Conflicts kept the branch's picker code and personal's Color Mixer pipette and auto straighten entries. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
|
I tested this PR locally and everything works as intended. Sampling in Rust from the original as-shot data makes the picker much more reliable: repeated clicks on the same spot now give consistent results. @lalibertemarc Thanks for this work! |
Owner
|
LGTM, thanks a lot!! |
This was referenced Oct 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Makes the white balance picker sample an area instead of a few pixels, and shows a colour preview while hovering.
Closes #1251 and potentially #1768. Partially addresses #747: it adds the colour preview under the cursor, but not the magnifier loupe.
Clicking the same spot often gave very different results (#1251). The old picker averaged an 11×11 patch of the medium thumbnail JPEG, which caused that in several ways:
Sampling now runs in Rust on the original image, the same linear data the shader's white balance step works on.
How it works now
Type of Change
Changes Made
src-tauri/src/image_processing.rs: newsample_white_balancecommand.white_balance::pick_white_balancefrom feat(color): Kelvin white balance mode and physically based white balance #1830, with the image's as-shot white balance as the current one, because the original image is rendered at as-shot. It returns an absolute Kelvin/tint.spawn_blocking, because it is called while hovering.apply_srgb_to_linearnow reuses the samesrgb_channel_to_linearhelper rather than keeping its own copy of the curve.src-tauri/src/white_balance.rs:pick_white_balanceis no longer called from the frontend, so it is a plain function instead of a Tauri command.src-tauri/src/lib.rs: registerssample_white_balanceand drops thepick_white_balancecommand.src/components/panel/editor/ImageCanvas.tsxhandleWbClick.mapScreenToUv.WbSampleOutline).src/components/ui/AppProperties.tsx: addsInvokes.SampleWhiteBalanceand removes the now unusedInvokes.PickWhiteBalance.No new translation keys. The swatch reuses the existing Temperature/Tint labels.
Screenshots/Videos
Temperature is displayed in Kelvin when Kelvin mode is on
drag and drop for bigger detect zone :

Testing
Test Configuration:
All checks below were compared against
upstream/main(48aac8a):tsc: 70 errors, the same as upstream, none in the changed files.ImageCanvas.tsxhas 72 problems against 73 on upstream (oneanyremoved);AppProperties.tsxis unchanged.i18n:check,check-runtime.mjsandi18n:lint: same output as upstream.cargo clippy --all-targets: 0 warnings.rustfmt: clean.cargo test: the 5 new tests pass.Checklist
Additional Notes
Known approximations. The sample is read from the original image before any edits, at the as-shot white balance, which is what the absolute Kelvin/tint pick needs. This means:
Rebased on #1830 (Kelvin white balance mode). Now that #1830 is merged, this branch is rebased onto
main. The last commit connects the area sampler to #1830'spick_white_balance, so picks give the same Kelvin/tint model as the rest of the white balance panel.AI Disclaimer:
Please state the involvement of AI in this PR:
🤖 Generated with Claude Code