Files
photocraft/crates/engine
UnemarsandClaude Opus 5.5 f08cffd4d1 Select › Color Range: Photoshop's Sampled Colors model, Subtract from Sample and the eyedropper on the image (#1239)
* Color Range: Photoshop's Sampled Colors model and the eyedropper on the canvas

Sampled Colors now compares colours in Lab (through the document's profile) the way
Photoshop does, reconstructed from Photoshop 2024's own masks (observation only):
per-axis distance outside the samples' Lab box in 8-bit units, a/b weighted x3, the
largest of the three, and a quadratic B-spline falloff of width fuzziness*256/255.
On 8-bit sRGB images it matches Photoshop to under one level of 255 on average
(the previous per-channel RGB distance was off by about 12). Several samples span
one Lab box, like Photoshop's Minimum/Maximum.

While Color Range is open, the pointer over the free canvas is its eyedropper:
a click picks that pixel, Shift adds to the sample, Alt subtracts (also through
ui.pointer on the control channel).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* Color Range: Photoshop's Subtract from Sample, click order, 8-bit Lab grid

Measured through Photoshop's real Color Range dialog (eyedropper clicks):
- Subtract from Sample reshapes the samples' Lab box per axis: inside it the
  nearer edge moves onto the subtracted value; on an edge or within the axis
  width w it moves in to the first of m + k*w/5 beyond it (k <= 5); further out
  nothing changes; an edge never crosses the other. Matches every measured box
  to +-0.05. The click order matters, so select.colorRange takes an optional
  `order` list and the dialog records it.
- The a/b centring shift of the previous change was an artefact of scripted
  samples (Photoshop's descriptor Lab scale); with the eyedropper the sampled
  colour is fully selected at any fuzziness. Removed.
- 8-bit documents compare pixels and samples on the 8-bit Lab grid, where an
  a/b step above the samples' range counts half a unit more and one below half
  a unit less (lab_range_coverage_8bit).
On Photoshop's eyedropper masks of a photo the mean error is ~0.46 levels of
255 at fuzziness 40/80 and ~0.02 at 5/10 (previous change ~0.9).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-08 16:19:39 -04:00
..