Skip to content

PhotoCraft: An open-source, photo editor written by scratch in pure Rust

Modern Brightness/Contrast: Photoshop's brightness curve (six oracles pass) (#4722)

Timothy Daly00c16f2c6d42
diff --git a/crates/compose/src/adjust.rs b/crates/compose/src/adjust.rs
index aff87ece0..3fc885336 100644
--- a/crates/compose/src/adjust.rs
+++ b/crates/compose/src/adjust.rs
@@ -96,18 +96,12 @@ pub fn apply_depth(adj: &Adjustment, buf: &mut Buffer, transfer: Transfer, depth
}
}
Adjustment::BrightnessContrast { brightness, contrast, .. } => {
- // Modern (CS3+) Brightness/Contrast, reverse-engineered from Photoshop ground truth
- // (a 0..255 ramp pushed through the real app; see log/devlog.md). Unlike the legacy
- // linear scale, both are smooth curves that pin pure black and white:
- // • Brightness: a line of slope s = 1.375^(b/50) from the origin that rolls off to
- // (1,1) via a `v^P` white-anchor term (P grows as |b| grows).
- // • Contrast: a symmetric cubic-Hermite S-curve pivoting at 0.5, with endpoint slope
- // 1 - c/128 and centre slope 1 + c/128 (near-exact: ≤0.5/255 vs Photoshop).
- // Applied brightness-then-contrast. Exact at the sliders' zero and extremes still drift
- // on the brightness side (the real curve is a spline); contrast matches closely.
- let b = *brightness;
- let c = *contrast;
- map_rgb(buf, |px| px.map(|v| modern_contrast(modern_brightness(v, b), c).clamp(0.0, 1.0)))
+ // Modern (CS3+) Brightness/Contrast, reverse-engineered from Photoshop ground truth.
+ // Unlike the legacy linear scale, both are smooth curves that pin pure black and white
+ // (see `modern_brightness` and `modern_contrast`), applied brightness then contrast
+ // through one lookup table.
+ let table = modern_lut(*brightness, *contrast);
+ map_rgb(buf, |px| px.map(|v| lut(&table, v)))
}
Adjustment::Exposure { exposure, offset, gamma } => {
// In linear light: (lin·2^exposure + offset)^(1/gamma), then back
@@ -456,7 +450,11 @@ fn apply_lab(adj: &Adjustment, buf: &mut Buffer, depth: Option<SampleType>) {
}
Adjustment::BrightnessContrast { brightness, contrast, legacy } => {
let legacy_curve = legacy_brightness_contrast(*brightness, *contrast);
- let curve = |v: f32| if *legacy { legacy_curve(v) } else { modern_contrast(modern_brightness(v, *brightness), *contrast).clamp(0.0, 1.0) };
+ let modern = (!*legacy).then(|| modern_lut(*brightness, *contrast));
+ let curve = |v: f32| match &modern {
+ Some(table) => lut(table, v),
+ None => legacy_curve(v),
+ };
// The tone curve on L only. Added as the difference of two round trips (like
// `tone_in_space`) so a and b, and colours a round trip moves, stay put.
map_rgb(buf, |c| {
@@ -926,20 +924,118 @@ fn hsv_hue(c: [f32; 3], mx: f32, mn: f32) -> f32 {
h * 60.0
}
-/// Photoshop posterize: `n` equal input bins over 0..=255, output levels
-/// `floor(k * 255 / (n - 1))` (exact on the corpus for 3, 7, 13 and 21 levels).
-/// Modern Brightness curve (one channel, `brightness` in [-150, 150]). A line of slope
-/// `s = 1.375^(b/50)` from the origin, rolled off to (1, 1) by a `v^P` white-anchor term. Pins pure
-/// black and white; `b = 0` is the identity. Fit to Photoshop ground truth (see modern B/C above).
+/// Modern Brightness curve (one channel, `brightness` in [-150, 150]); pins pure black and white,
+/// and `b = 0` is the identity. Raised, it is a line of slope `s = 1.375^(b/50)` from the origin
+/// up to a knee at output 126/255, then a cubic Hermite to (1, 1) whose end slope is
+/// `1 / (1 + 0.084 b)`; past about +110, where no such cubic stays below white, the roll-off is
+/// `1 - (1 - y0)(1 - u)^α` instead (continuous slope `α` at the knee, flat at white). Lowered, it
+/// is the inverse of the curve raised by as much.
+///
+/// Fit to every Photoshop measurement we have, all within about a level and a half: its ±50
+/// samples (`modern_brightness_matches_photoshop`), the photoshop corpus's brightness-contrast.psd
+/// (+25 with contrast +30) and psd-tools' brightnesscontrast_rgb.psd, whose masked layers give
+/// +23, -31 and -95 (+150 within 6 levels there, where every curve family tried bottoms out).
pub fn modern_brightness(v: f32, brightness: f32) -> f32 {
- if brightness == 0.0 {
+ if brightness == 0.0 || !brightness.is_finite() {
return v;
}
- let s = 1.375f32.powf(brightness / 50.0);
- // Exponent of the white-anchor term grows with |b|; shapes the roll-off toward (1,1).
- let p = if brightness >= 0.0 { (4.5 - 0.013 * brightness).max(2.0) } else { 5.0 - 0.072 * brightness };
- let v = v.clamp(0.0, 1.0);
- (s * v + (1.0 - s) * v.powf(p)).clamp(0.0, 1.0)
+ Brightness::new(brightness).eval(v)
+}
+
+/// [`modern_brightness`] for one slider value, its curve's constants worked out once.
+struct Brightness {
+ raise: bool,
+ s: f32,
+ e: f32,
+ x0: f32,
+ /// The knee's slope over the roll-off's secant (`α` of Fritsch–Carlson); a power roll-off
+ /// replaces the Hermite when α² + β² > 9.
+ alpha: f32,
+ hermite: bool,
+}
+
+/// Output level of the Brightness curve's knee.
+const BRIGHTNESS_KNEE: f32 = 126.0 / 255.0;
+
+impl Brightness {
+ fn new(brightness: f32) -> Self {
+ let b = brightness.abs();
+ let s = 1.375f32.powf(b / 50.0);
+ let e = 1.0 / (1.0 + 0.084 * b);
+ let x0 = (BRIGHTNESS_KNEE / s).min(1.0);
+ let secant = (1.0 - BRIGHTNESS_KNEE) / (1.0 - x0).max(1e-6);
+ let (alpha, beta) = (s / secant, e / secant);
+ Brightness { raise: brightness > 0.0, s, e, x0, alpha, hermite: alpha * alpha + beta * beta <= 9.0 }
+ }
+
+ fn eval(&self, v: f32) -> f32 {
+ let v = v.clamp(0.0, 1.0);
+ if self.raise {
+ return self.raised(v);
+ }
+ if v <= 0.0 || v >= 1.0 {
+ return v;
+ }
+ // The inverse of the raised curve (monotone on [0, 1]), by bisection.
+ let (mut lo, mut hi) = (0.0f32, 1.0f32);
+ for _ in 0..32 {
+ let mid = 0.5 * (lo + hi);
+ if self.raised(mid) < v {
+ lo = mid;
+ } else {
+ hi = mid;
+ }
+ }
+ 0.5 * (lo + hi)
+ }
+
+ /// The curve raised: the line, then a monotone roll-off to (1, 1).
+ fn raised(&self, x: f32) -> f32 {
+ let Brightness { s, e, x0, alpha, hermite, .. } = *self;
+ let y0 = BRIGHTNESS_KNEE;
+ if x <= x0 {
+ return y0.min(s * x);
+ }
+ let h = (1.0 - x0).max(1e-6);
+ let t = ((x - x0) / h).clamp(0.0, 1.0);
+ let y = if hermite {
+ let (t2, t3) = (t * t, t * t * t);
+ (2.0 * t3 - 3.0 * t2 + 1.0) * y0 + (t3 - 2.0 * t2 + t) * h * s + (-2.0 * t3 + 3.0 * t2) + (t3 - t2) * h * e
+ } else {
+ 1.0 - (1.0 - y0) * (1.0 - t).powf(alpha)
+ };
+ y.clamp(0.0, 1.0)
+ }
+}
+
+/// Modern Brightness/Contrast as one channel's lookup table (4096 samples over 0..1):
+/// [`modern_brightness`] then [`modern_contrast`], as Photoshop applies them.
+pub fn modern_lut(brightness: f32, contrast: f32) -> Vec<f32> {
+ let step = |k: usize, n: usize| k as f32 / (n - 1) as f32;
+ let bright: Vec<f32> = if brightness == 0.0 || !brightness.is_finite() {
+ (0..LUT_SIZE).map(|k| step(k, LUT_SIZE)).collect()
+ } else if brightness > 0.0 {
+ let curve = Brightness::new(brightness);
+ (0..LUT_SIZE).map(|k| curve.raised(step(k, LUT_SIZE))).collect()
+ } else {
+ // Lowered: invert the raised curve, sampled four times finer, in one monotone pass.
+ let curve = Brightness::new(-brightness);
+ let fine = 4 * LUT_SIZE;
+ let ys: Vec<f32> = (0..fine).map(|j| curve.raised(step(j, fine))).collect();
+ let mut j = 0;
+ (0..LUT_SIZE)
+ .map(|k| {
+ let y = step(k, LUT_SIZE);
+ while j + 2 < fine && ys.get(j + 1).is_some_and(|&n| n < y) {
+ j += 1;
+ }
+ let (y0, y1) = (ys.get(j).copied().unwrap_or(0.0), ys.get(j + 1).copied().unwrap_or(1.0));
+ let f = if y1 > y0 { ((y - y0) / (y1 - y0)).clamp(0.0, 1.0) } else { 0.0 };
+ (step(j, fine) + f / (fine - 1) as f32).clamp(0.0, 1.0)
+ })
+ .collect()
+ };
+ bright.into_iter().map(|b| modern_contrast(b, contrast).clamp(0.0, 1.0)).collect()
}
/// Modern Contrast curve (one channel, `contrast` in [-50, 100]). A symmetric cubic-Hermite S-curve
@@ -957,6 +1053,8 @@ pub fn modern_contrast(v: f32, contrast: f32) -> f32 {
if v <= 0.5 { half(v / 0.5) } else { 1.0 - half((1.0 - v) / 0.5) }
}
+/// Photoshop posterize: `n` equal input bins over 0..=255, output levels
+/// `floor(k * 255 / (n - 1))` (exact on the corpus for 3, 7, 13 and 21 levels).
pub fn posterize(v: f32, levels: u32) -> f32 {
let n = levels.clamp(2, 255) as f32;
let x = (v.clamp(0.0, 1.0) * 255.0).round();
diff --git a/crates/compose/src/tests.rs b/crates/compose/src/tests.rs
index f9210a884..75cbcce06 100644
--- a/crates/compose/src/tests.rs
+++ b/crates/compose/src/tests.rs
@@ -1728,6 +1728,43 @@ fn modern_contrast_matches_photoshop() {
}
}
+/// Over the whole slider range the curve stays monotone and inside 0..1, lowering it undoes
+/// raising it by as much, and odd input never panics.
+#[test]
+fn modern_brightness_is_monotone_and_lowering_inverts_raising() {
+ for b in (-150..=150).step_by(5).map(|b| b as f32) {
+ let mut prev = 0.0f32;
+ for k in 0..=1020 {
+ let v = adjust::modern_brightness(k as f32 / 1020.0, b);
+ assert!((0.0..=1.0).contains(&v) && v >= prev - 1e-6, "brightness {b} at {k}/1020: {v} after {prev}");
+ prev = v;
+ }
+ assert!(
+ (adjust::modern_brightness(1.0, b) - 1.0).abs() < 1e-5 && adjust::modern_brightness(0.0, b).abs() < 1e-5,
+ "brightness {b} pins black and white"
+ );
+ for k in 0..=50 {
+ let x = k as f32 / 50.0;
+ let back = adjust::modern_brightness(adjust::modern_brightness(x, b), -b);
+ assert!((back - x).abs() < 2e-3, "brightness {b}: {x} -> {back}");
+ }
+ }
+ for v in [f32::NAN, f32::INFINITY, -3.0, 7.0] {
+ let _ = adjust::modern_brightness(v, 40.0);
+ let _ = adjust::modern_brightness(0.5, v);
+ }
+ assert_eq!(adjust::modern_lut(0.0, 0.0).len(), 4096);
+ // The table agrees with the curves it samples, lowered (inverted in one pass) or raised.
+ for (b, c) in [(-50.0, 30.0), (-150.0, -50.0), (40.0, 0.0), (0.0, 100.0)] {
+ let t = adjust::modern_lut(b, c);
+ for k in (0..4096).step_by(37) {
+ let x = k as f32 / 4095.0;
+ let want = adjust::modern_contrast(adjust::modern_brightness(x, b), c);
+ assert!((t[k] - want).abs() < 1e-3, "({b}, {c}) at {k}: {} vs {want}", t[k]);
+ }
+ }
+}
+
#[test]
fn modern_brightness_matches_photoshop() {
let cases: [(f32, [u8; 10]); 2] = [(50.0, [0, 22, 44, 88, 132, 171, 203, 228, 246, 255]), (-50.0, [0, 12, 23, 47, 70, 93, 118, 148, 186, 255])];
@@ -1736,8 +1773,48 @@ fn modern_brightness_matches_photoshop() {
for (i, &x) in xs.iter().enumerate() {
let got = adjust::modern_brightness(x as f32 / 255.0, b) * 255.0;
let err = (got - out[i] as f32).abs();
- // The brightness roll-off is a spline; our fit is close but approximate at the top.
- assert!(err <= 6.0, "brightness {b} x={x}: got {got:.1} want {} (err {err:.1})", out[i]);
+ // Within about a level of Photoshop's (rounded) output everywhere.
+ assert!(err <= 1.2, "brightness {b} x={x}: got {got:.1} want {} (err {err:.1})", out[i]);
+ }
+ }
+ // Photoshop 27.11's brightness +25 with contrast +30 (photoshop corpus rgb8
+ // brightness-contrast.psd): what the oracle's levels become.
+ let oracle = [
+ (8, 7),
+ (24, 23),
+ (48, 49),
+ (72, 78),
+ (88, 99),
+ (104, 120),
+ (128, 154),
+ (144, 174),
+ (160, 192),
+ (176, 208),
+ (192, 222),
+ (200, 228),
+ (216, 239),
+ (232, 247),
+ (240, 250),
+ (248, 253),
+ ];
+ for (x, want) in oracle {
+ let got = adjust::modern_contrast(adjust::modern_brightness(x as f32 / 255.0, 25.0), 30.0) * 255.0;
+ assert!((got - want as f32).abs() <= 1.0, "+25/+30 x={x}: got {got:.2} want {want}");
+ }
+ // psd-tools' brightnesscontrast_rgb.psd masks four layers to their own columns: the brightness
+ // each applies, read back through its (exact) contrast curve.
+ // (brightness, tolerance in levels, [(input level, Photoshop's output level)])
+ type Measured = (f32, f32, &'static [(u32, f32)]);
+ let measured: [Measured; 4] = [
+ (-95.0, 1.5, &[(24, 13.3), (64, 35.1), (96, 52.9), (128, 69.7), (160, 89.6), (192, 114.4), (224, 151.6)]),
+ (-31.0, 1.5, &[(24, 20.3), (64, 53.4), (96, 79.0), (128, 105.6), (160, 132.3), (192, 161.8), (224, 197.4)]),
+ (23.0, 1.5, &[(24, 27.9), (64, 74.0), (96, 110.9), (128, 147.7), (160, 182.9), (192, 213.7), (224, 239.6)]),
+ (150.0, 6.0, &[(24, 60.3), (64, 162.1), (96, 214.5), (128, 238.4), (160, 248.9)]),
+ ];
+ for (b, tol, points) in measured {
+ for &(x, want) in points {
+ let got = adjust::modern_brightness(x as f32 / 255.0, b) * 255.0;
+ assert!((got - want).abs() <= tol, "brightness {b} x={x}: got {got:.1} want {want}");
}
}
// Endpoints and the zero slider are exact.
@@ -2899,6 +2976,16 @@ fn shape_layer_bounds_includes_vector_bounds_clipped_to_canvas_and_preserves_eff
assert!(b_fx.contains_rect(&b));
}
+#[test]
+#[ignore = "timing: cargo test --release -p photocraft-compose modern_lut_timing -- --ignored --nocapture"]
+fn modern_lut_timing() {
+ let t = std::time::Instant::now();
+ for _ in 0..100 {
+ std::hint::black_box(adjust::modern_lut(-50.0, 30.0));
+ }
+ println!("modern_lut(-50, 30): {:?} each", t.elapsed() / 100);
+}
+
// A pass-through group with an adjustment layer reaches the layers beneath, unless the group is
// the base of a clipping group: then Photoshop renders it isolated, and an adjustment with no
// content of its own in the group changes nothing (psd-tools passthrough_clipping_mask_adjustment).
diff --git a/crates/gpu/src/compose.wgsl b/crates/gpu/src/compose.wgsl
index 1cfcd6b45..2b9c1bbdf 100644
--- a/crates/gpu/src/compose.wgsl
+++ b/crates/gpu/src/compose.wgsl
@@ -591,31 +591,6 @@ fn tone_channel(row: i32, v: f32, identity: f32) -> f32 {
return lut(row, v);
}
-// Modern Brightness curve: line of slope 1.375^(b/50) rolled off to (1,1) by a v^P white anchor.
-// Mirrors compose::adjust::modern_brightness.
-fn mbright(v: f32, b: f32) -> f32 {
- if (b == 0.0) { return v; }
- let s = pow(1.375, b / 50.0);
- var p: f32;
- if (b >= 0.0) { p = max(4.5 - 0.013 * b, 2.0); } else { p = 5.0 - 0.072 * b; }
- let vv = clamp(v, 0.0, 1.0);
- return clamp(s * vv + (1.0 - s) * pow(vv, p), 0.0, 1.0);
-}
-
-// Modern Contrast curve: symmetric cubic-Hermite S pivoting at 0.5.
-// Mirrors compose::adjust::modern_contrast.
-fn mcontrast(v: f32, ct: f32) -> f32 {
- if (ct == 0.0) { return v; }
- let k = ct / 128.0;
- let e = 1.0 - k; let m = 1.0 + k;
- let vv = clamp(v, 0.0, 1.0);
- var t: f32;
- if (vv <= 0.5) { t = vv / 0.5; } else { t = (1.0 - vv) / 0.5; }
- let h = e * 0.5 * (t * t * t - 2.0 * t * t + t) + (-2.0 * t * t * t + 3.0 * t * t) * 0.5 + m * 0.5 * (t * t * t - t * t);
- if (vv <= 0.5) { return h; }
- return 1.0 - h;
-}
-
fn adjust(c: vec3<f32>) -> vec3<f32> {
let hdr = (op.flags & F_HDR) != 0u;
let p0 = op.p0;
@@ -645,12 +620,8 @@ fn adjust(c: vec3<f32>) -> vec3<f32> {
if (hdr) { return v; }
return clamp(v, vec3(0.0), vec3(1.0));
}
- case 5: { // B/C modern
- let b = p0.x; let ct = p0.y;
- return vec3(mcontrast(mbright(c.r, b), ct), mcontrast(mbright(c.g, b), ct), mcontrast(mbright(c.b, b), ct));
- }
case 6: { return vec3(exposure(c.r, p0), exposure(c.g, p0), exposure(c.b, p0)); } // Exposure
- case 7: { return vec3(tone_channel(0, c.r, p0.x), tone_channel(1, c.g, p0.y), tone_channel(2, c.b, p0.z)); } // Levels / Curves
+ case 7: { return vec3(tone_channel(0, c.r, p0.x), tone_channel(1, c.g, p0.y), tone_channel(2, c.b, p0.z)); } // Levels / Curves / modern Brightness/Contrast (compose::adjust::modern_lut)
case 17: { return vec3(levels_float(0, levels_float(1, c.r)), levels_float(0, levels_float(2, c.g)), levels_float(0, levels_float(3, c.b))); }
case 8: { // Hue/Saturation
let hsl = rgb_to_hsl(c);
diff --git a/crates/gpu/src/plan.rs b/crates/gpu/src/plan.rs
index 9bc6ae173..96853217d 100644
--- a/crates/gpu/src/plan.rs
+++ b/crates/gpu/src/plan.rs
@@ -1623,10 +1623,10 @@ pub fn adjustment_program(adj: &Adjustment, transfer: Transfer, depth: photocraf
(4, p, None)
}
Adjustment::BrightnessContrast { brightness, contrast, .. } => {
- // Modern B/C: the shader rebuilds the curves from raw slider values (see compose.wgsl
- // `mbright`/`mcontrast`, mirroring compose::adjust::modern_brightness/modern_contrast).
- p[0] = [*brightness, *contrast, 0.0, 0.0];
- (5, p, None)
+ // Modern B/C: the CPU's lookup table (compose::adjust::modern_lut) on every channel,
+ // through the Levels / Curves kernel.
+ let row = to_row(&adjust::modern_lut(*brightness, *contrast));
+ (7, p, Some(vec![row; 3]))
}
Adjustment::Exposure { exposure, offset, gamma } => {
p[0] = [2f32.powf(*exposure), *offset, gamma.max(0.01), transfer_exponent(transfer.for_exposure())];
diff --git a/docs/file-format-parity.md b/docs/file-format-parity.md
index a77e9ea38..0efb5bbd0 100644
--- a/docs/file-format-parity.md
+++ b/docs/file-format-parity.md
@@ -1,6 +1,6 @@
# File-format parity
-> **Last reviewed:** 2026-10-12 · **Last updated:** 2026-10-13 · **Change:** minor (Lab documents composite on their stored L, a, b; Photoshop-oracle floor 152/258; Levels on whole levels at every step with Photoshop's shadow toe; Photoshop-oracle floor 146/258, psd-tools 238/309; 32-bit adjustments unclipped; Photoshop-oracle floor 149/258; mask feathers blur with their exact variance; Threshold splits on Photoshop's luminosity; a pass-through clipping base with an adjustment renders isolated; psd-tools oracle floor 240/309; 16-bit Posterize as Photoshop bins it; psd-tools oracle floor 241/309; Gradient Map luminosity; Photoshop-oracle floor 147/258; PSD: `Mt16`/`Mt32` merged transparency read; palette PNGs open in Indexed Color mode, #4804; earlier: CMYK Invert, Posterize and Threshold on the inks; 16-bit Lab Invert; Photoshop-oracle floor 145/258; `.atn` import maps 112 events; DDS textures open, #1327; DPX read and write, #1049; #2465 fixed: CS2 placed layers with only a `PlLd` block open their contents; Photoshop Actions `.atn` read and write; `.shc` contour files read and write; earlier the same day: indexed BMP palette mode; Save keeps a JPEG's quality and a WebP's encoding) · **Target:** Adobe Photoshop 2026
+> **Last reviewed:** 2026-10-12 · **Last updated:** 2026-10-13 · **Change:** minor (modern Brightness/Contrast's brightness curve; Photoshop-oracle floor 151/258; Lab documents composite on their stored L, a, b; Photoshop-oracle floor 152/258; Levels on whole levels at every step with Photoshop's shadow toe; Photoshop-oracle floor 146/258, psd-tools 238/309; 32-bit adjustments unclipped; Photoshop-oracle floor 149/258; mask feathers blur with their exact variance; Threshold splits on Photoshop's luminosity; a pass-through clipping base with an adjustment renders isolated; psd-tools oracle floor 240/309; 16-bit Posterize as Photoshop bins it; psd-tools oracle floor 241/309; Gradient Map luminosity; Photoshop-oracle floor 147/258; PSD: `Mt16`/`Mt32` merged transparency read; palette PNGs open in Indexed Color mode, #4804; earlier: CMYK Invert, Posterize and Threshold on the inks; 16-bit Lab Invert; Photoshop-oracle floor 145/258; `.atn` import maps 112 events; DDS textures open, #1327; DPX read and write, #1049; #2465 fixed: CS2 placed layers with only a `PlLd` block open their contents; Photoshop Actions `.atn` read and write; `.shc` contour files read and write; earlier the same day: indexed BMP palette mode; Save keeps a JPEG's quality and a WebP's encoding) · **Target:** Adobe Photoshop 2026
Every format Photoshop 2026 (27.11.0) reads or writes, with PhotoCraft's support, fidelity and
tests. Photoshop's list comes from its `Info.plist` `CFBundleDocumentTypes`, the PiPL read/write
@@ -142,6 +142,7 @@ remaining gaps in #1606 stay tracked with per-sample corpus ceilings.
| Date | Change | Summary |
|---|---|---|
+| 2026-10-13 | minor | Modern Brightness/Contrast: the brightness curve refit to Photoshop, so the rgb and gray 8/16/32 brightness-contrast oracles pass; Photoshop-oracle floor 145 → 151 of 258 |
| 2026-10-13 | minor | Lab documents of plain layers with Invert, Posterize, Threshold, Brightness/Contrast or Lab Levels/Curves adjustment layers composite on the stored L, a, b instead of clipped display RGB, and flattening keeps them: lab16 invert, posterize-4, levels, curves and legacy Brightness/Contrast and lab8 invert and posterize-4 pass; Photoshop-oracle floor 145 → 152 of 258 |
| 2026-10-13 | minor | Levels round the gamma and output steps to whole levels too (8-bit), and the gamma above 1 starts along a toe of slope 2^gamma that joins the power curve: psd-tools levels_rgb and rgb8 stack-levels-curves-hue-posterize pass, rgb8/gray8 levels.psd exact; Photoshop-oracle floor 145 → 146 of 258, psd-tools 236 → 238 of 309 |
| 2026-10-13 | minor | 32-bit documents: legacy Brightness/Contrast, Channel Mixer, Photo Filter and the Black & White tint keep values above 1 and below 0 as Photoshop does (rgb32/gray32 brightness-contrast-legacy, rgb32 channel-mixer and black-white-tint pass); Photoshop-oracle floor 145 → 149 of 258 |
diff --git a/docs/gaps.md b/docs/gaps.md
index 98fcd8cd2..e66b9a32b 100644
--- a/docs/gaps.md
+++ b/docs/gaps.md
@@ -1,6 +1,6 @@
# Where PhotoCraft falls short of Photoshop
-> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-13 · **Change:** minor (G1: Lab documents composite on their stored L, a, b, Photoshop-oracle floor 152/258; G1: Levels on whole levels at every step, Photoshop-oracle floor 146/258, psd-tools 238/309; G1: 32-bit Brightness/Contrast legacy, Channel Mixer, Photo Filter and Black & White tint unclipped as in Photoshop, Photoshop-oracle floor 149/258; G1: mask feathers blur with their exact variance, psd-tools oracle floor 240/309; G1: Threshold splits on Photoshop's luminosity, psd-tools oracle floor 241/309; G1: pass-through clipping base with an adjustment renders isolated, psd-tools oracle floor 240/309; G1: 16-bit Posterize as Photoshop bins it, psd-tools oracle floor 241/309; G1: Gradient Map driven by the W3C luminosity, Photoshop-oracle floor 147/258; G7: Field Blur's on-canvas pins, #3373; G4: Hue Jitter amount track, #3825 partial; G4: minimum field interaction, #3825 partial; G1: CMYK Invert, Posterize and Threshold on the inks, 16-bit Lab Invert; Photoshop-oracle floor 145/258; G11: `.atn` import maps 112 events: Select and Mask, Filter Gallery Spatter, Ripple, Crystallize, Pattern Fill layers, mask targeting, Step Backward, nudges in points, Bitmap mode; G5: Free Transform H/V skew fields; G9: toolbar tool shortcut editing; refreshed against main: G2, G5, G7, G9, G10, G13, G14, G17 items that landed; G10: DPX read and write, #1049; G4: checkbox-only Brush Settings rows; G11: Load/Save Actions `.atn` landed, AUTO-219-2 partial; G5: hold-a-key spring-loaded tools landed, #2672; G1: #2465 fixed; stale missing-tool rows corrected: Color Replacement, Red Eye and Add/Delete Anchor Point are live tools, so only Art History Brush is missing; no estimate changed) · **Target:** Adobe Photoshop 2026
+> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-13 · **Change:** minor (G1: modern Brightness/Contrast's brightness curve matches Photoshop, Photoshop-oracle floor 151/258; G1: Lab documents composite on their stored L, a, b, Photoshop-oracle floor 152/258; G1: Levels on whole levels at every step, Photoshop-oracle floor 146/258, psd-tools 238/309; G1: 32-bit Brightness/Contrast legacy, Channel Mixer, Photo Filter and Black & White tint unclipped as in Photoshop, Photoshop-oracle floor 149/258; G1: mask feathers blur with their exact variance, psd-tools oracle floor 240/309; G1: Threshold splits on Photoshop's luminosity, psd-tools oracle floor 241/309; G1: pass-through clipping base with an adjustment renders isolated, psd-tools oracle floor 240/309; G1: 16-bit Posterize as Photoshop bins it, psd-tools oracle floor 241/309; G1: Gradient Map driven by the W3C luminosity, Photoshop-oracle floor 147/258; G7: Field Blur's on-canvas pins, #3373; G4: Hue Jitter amount track, #3825 partial; G4: minimum field interaction, #3825 partial; G1: CMYK Invert, Posterize and Threshold on the inks, 16-bit Lab Invert; Photoshop-oracle floor 145/258; G11: `.atn` import maps 112 events: Select and Mask, Filter Gallery Spatter, Ripple, Crystallize, Pattern Fill layers, mask targeting, Step Backward, nudges in points, Bitmap mode; G5: Free Transform H/V skew fields; G9: toolbar tool shortcut editing; refreshed against main: G2, G5, G7, G9, G10, G13, G14, G17 items that landed; G10: DPX read and write, #1049; G4: checkbox-only Brush Settings rows; G11: Load/Save Actions `.atn` landed, AUTO-219-2 partial; G5: hold-a-key spring-loaded tools landed, #2672; G1: #2465 fixed; stale missing-tool rows corrected: Color Replacement, Red Eye and Add/Delete Anchor Point are live tools, so only Art History Brush is missing; no estimate changed) · **Target:** Adobe Photoshop 2026
Every known shortfall against Photoshop 2026 (27.11.0), one entry each, ranked by user impact
on the way to beta. This is the work list agents pick from: take the highest-ranked entry that
@@ -262,6 +262,7 @@ what an agent can't finish alone.
| Date | Change | Summary |
|---|---|---|
+| 2026-10-13 | minor | G1: modern Brightness/Contrast's brightness curve refit to Photoshop (six oracles pass); Photoshop-oracle floor 145 → 151 of 258 |
| 2026-10-13 | minor | G1: Lab documents composite Invert, Posterize, Threshold, Brightness/Contrast and Lab Levels/Curves on their stored L, a, b (no clipped RGB round trip); seven Lab oracles pass; Photoshop-oracle floor 145 → 152 of 258 |
| 2026-10-13 | minor | G1: Levels round every step to whole levels and use Photoshop's shadow toe (slope 2^gamma); levels_rgb and stack-levels-curves-hue-posterize pass; Photoshop-oracle floor 145 → 146 of 258, psd-tools 236 → 238 of 309 |
| 2026-10-13 | minor | G1: 32-bit legacy Brightness/Contrast (pivot 127), Channel Mixer (1/1024 steps, constant ×255/512), Photo Filter and Black & White tint unclipped as Photoshop computes them, CPU and GPU; Photoshop-oracle floor 145 → 149 of 258 |