Skip to content

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

CMYK: Brightness/Contrast curves each ink, as Photoshop does (#4930)

Timothy Daly92c79222304b
diff --git a/crates/compose/src/adjust.rs b/crates/compose/src/adjust.rs
index 3fc885336..4d37aa39a 100644
--- a/crates/compose/src/adjust.rs
+++ b/crates/compose/src/adjust.rs
@@ -269,11 +269,16 @@ fn legacy_brightness_contrast_hdr(brightness: f32, contrast: f32) -> impl Fn(f32
/// Legacy Brightness/Contrast as one channel's tone curve (see [`apply_depth`]).
fn legacy_brightness_contrast(brightness: f32, contrast: f32) -> impl Fn(f32) -> f32 {
+ legacy_brightness_contrast_at(brightness, contrast, LEGACY_PIVOT)
+}
+
+/// [`legacy_brightness_contrast`] with contrast pivoting at `pivot`.
+fn legacy_brightness_contrast_at(brightness: f32, contrast: f32, pivot: f32) -> impl Fn(f32) -> f32 {
let b = brightness / 255.0;
let c = contrast.clamp(-100.0, 99.0);
let k = if c >= 0.0 { 1.0 / (1.0 - c / 100.0) } else { 1.0 + c / 100.0 };
let (pre, post) = if c >= 0.0 { (b, 0.0) } else { (0.0, b) };
- move |v: f32| ((v + pre - LEGACY_PIVOT) * k + LEGACY_PIVOT + post).clamp(0.0, 1.0)
+ move |v: f32| ((v + pre - pivot) * k + pivot + post).clamp(0.0, 1.0)
}
/// Whether Threshold at `level` turns colour `c` white in a document of `depth` (`None`: unknown,
@@ -308,11 +313,16 @@ pub fn apply_in(adj: &Adjustment, buf: &mut Buffer, transfer: Transfer, depth: O
apply_lab(adj, buf, depth);
} else if mode == ColorMode::Cmyk && cmyk_channel_adjustment(adj) {
use photocraft_color::convert::{cmyk_to_rgb, rgb_to_cmyk};
- map_rgb(buf, |c| {
- let mut ink = rgb_to_cmyk(c);
- stored_channels(adj, mode, depth, &mut ink, rgb_to_gray(c));
- cmyk_to_rgb(ink)
- });
+ if let Adjustment::BrightnessContrast { brightness, contrast, legacy } = adj {
+ let table = ink_brightness_contrast_lut(*brightness, *contrast, *legacy);
+ map_rgb(buf, |c| cmyk_to_rgb(rgb_to_cmyk(c).map(|v| ink_through(&table, v))));
+ } else {
+ map_rgb(buf, |c| {
+ let mut ink = rgb_to_cmyk(c);
+ stored_channels(adj, mode, depth, &mut ink);
+ cmyk_to_rgb(ink)
+ });
+ }
} else {
apply_depth(adj, buf, transfer, depth);
}
@@ -334,13 +344,33 @@ pub fn lab_channel_adjustment(adj: &Adjustment) -> bool {
}
/// Whether a CMYK document evaluates `adj` on its inks rather than on the screen colour: Invert
-/// and Posterize (each ink, black included, so paper inverts to 400% ink) and Threshold (paper or
-/// 100% black ink alone). Photoshop corpus cmyk8 and cmyk16 invert, posterize-4 and threshold-128
-/// follow these rules on the files' own inks on every pixel; here the inks are the screen colour
-/// separated through the document's CMYK profile, so neutrals carry the black that profile
-/// generates rather than the file's.
+/// and Posterize (each ink, black included, so paper inverts to 400% ink), Threshold (paper or
+/// 100% black ink alone) and Brightness/Contrast (each ink's stored value, 1 - ink, through the
+/// tone curve; see [`ink_through`]). Photoshop corpus cmyk8 and cmyk16 invert, posterize-4,
+/// threshold-128 and brightness-contrast(-legacy) follow these rules on the files' own inks on
+/// every pixel; here the inks are the screen colour separated through the document's CMYK
+/// profile, so neutrals carry the black that profile generates rather than the file's.
pub fn cmyk_channel_adjustment(adj: &Adjustment) -> bool {
- stored_channel_adjustment(adj)
+ stored_channel_adjustment(adj) || matches!(adj, Adjustment::BrightnessContrast { .. })
+}
+
+/// Brightness/Contrast as the lookup table (4096 samples over 0..1) a CMYK ink's stored value,
+/// `1 - ink`, goes through ([`ink_through`]): [`modern_lut`], or the legacy linear curve with its
+/// contrast pivoting at 128 in ink, which is 127 of 255 stored (photoshop corpus cmyk16
+/// brightness-contrast-legacy.psd sits 0.43 of a level off around 128 stored, as a one-level
+/// pivot shift times contrast +30's slope predicts).
+pub fn ink_brightness_contrast_lut(brightness: f32, contrast: f32, legacy: bool) -> Vec<f32> {
+ if !legacy {
+ return modern_lut(brightness, contrast);
+ }
+ let curve = legacy_brightness_contrast_at(brightness, contrast, 1.0 - LEGACY_PIVOT);
+ (0..LUT_SIZE).map(|k| curve(k as f32 / (LUT_SIZE - 1) as f32)).collect()
+}
+
+/// One CMYK ink (0: none) through a channel tone curve the way Photoshop applies one in CMYK: to
+/// the stored value, `1 - ink`, so raising brightness takes ink away.
+pub fn ink_through(table: &[f32], ink: f32) -> f32 {
+ 1.0 - lut(table, 1.0 - ink)
}
/// Whether [`stored_channels`] evaluates `adj`: Invert, Posterize and Threshold.
@@ -350,10 +380,10 @@ pub fn stored_channel_adjustment(adj: &Adjustment) -> bool {
/// Invert, Posterize or Threshold on one pixel's own channels in a Lab or CMYK document of
/// `depth` (`None`: unknown, treated as 8-bit): `ch` holds L, a, b normalised as [`lab_norm`]
-/// gives them, or the C, M, Y, K inks (0: none); `gray` is the pixel's luma, which CMYK Threshold
-/// compares. Lab Invert turns 8-bit bytes `v` into `255 - v` (a becomes -1 - a) and mirrors a and
-/// b around neutral at 16 bits (photoshop corpus lab16 invert.psd: neutral stays neutral).
-pub fn stored_channels(adj: &Adjustment, mode: ColorMode, depth: Option<SampleType>, ch: &mut [f32], gray: f32) {
+/// gives them, or the C, M, Y, K inks (0: none). Lab Invert turns 8-bit bytes `v` into `255 - v`
+/// (a becomes -1 - a) and mirrors a and b around neutral at 16 bits (photoshop corpus lab16
+/// invert.psd: neutral stays neutral). CMYK Threshold compares [`ink_luma`].
+pub fn stored_channels(adj: &Adjustment, mode: ColorMode, depth: Option<SampleType>, ch: &mut [f32]) {
let lab = mode == ColorMode::Lab;
match adj {
Adjustment::Invert => {
@@ -370,7 +400,9 @@ pub fn stored_channels(adj: &Adjustment, mode: ColorMode, depth: Option<SampleTy
let white = ch.first().is_some_and(|l| (l.clamp(0.0, 1.0) * 255.0).round() >= t);
[if white { 1.0 } else { 0.0 }, 128.0 / 255.0, 128.0 / 255.0, 0.0]
} else {
- [0.0, 0.0, 0.0, if (gray * 255.0).round() < t { 1.0 } else { 0.0 }]
+ let ink = |i: usize| ch.get(i).copied().unwrap_or(0.0);
+ let black = (ink_luma([ink(0), ink(1), ink(2), ink(3)]) * 255.0).round() < t;
+ [0.0, 0.0, 0.0, if black { 1.0 } else { 0.0 }]
};
ch.iter_mut().zip(out).for_each(|(v, o)| *v = o);
}
@@ -378,6 +410,14 @@ pub fn stored_channels(adj: &Adjustment, mode: ColorMode, depth: Option<SampleTy
}
}
+/// The luma Photoshop's CMYK Threshold compares: Rec. 601 weights on the inks' plain complement,
+/// `(1 - c)(1 - k)` and so on, whatever the document's profile (photoshop corpus cmyk8 and cmyk16
+/// threshold-128.psd: every pixel on the right side of level 128).
+pub fn ink_luma(ink: [f32; 4]) -> f32 {
+ let paper = 1.0 - ink[3].clamp(0.0, 1.0);
+ rgb_to_gray([0, 1, 2].map(|i| (1.0 - ink[i].clamp(0.0, 1.0)) * paper))
+}
+
/// Encoded sRGB → Lab normalised the way Photoshop's channels hold it: L/100, (a+128)/255,
/// (b+128)/255.
fn lab_norm(c: [f32; 3]) -> [f32; 3] {
@@ -401,7 +441,7 @@ pub const LAB_NEUTRAL: f32 = 128.0 / 255.0;
/// theirs, where [`apply_in`] can only round-trip them through clipped display RGB.
pub fn lab_stored_op(adj: &Adjustment, depth: Option<SampleType>) -> Option<LabOp<'_>> {
let op: LabOp<'_> = match adj {
- Adjustment::Invert | Adjustment::Posterize { .. } => Box::new(move |ch: &mut [f32; 3]| stored_channels(adj, ColorMode::Lab, depth, ch, 0.0)),
+ Adjustment::Invert | Adjustment::Posterize { .. } => Box::new(move |ch: &mut [f32; 3]| stored_channels(adj, ColorMode::Lab, depth, ch)),
Adjustment::Threshold { level } => {
// Split on L on the 8-bit grid, like the display path (`apply_lab`).
let t = (level * 255.0).round();
@@ -440,7 +480,7 @@ fn apply_lab(adj: &Adjustment, buf: &mut Buffer, depth: Option<SampleType>) {
// L → 100 - L and a, b mirrored about neutral; each channel posterized (see `stored_channels`).
Adjustment::Invert | Adjustment::Posterize { .. } => map_rgb(buf, |c| {
let mut n = lab_norm(c);
- stored_channels(adj, ColorMode::Lab, depth, &mut n, 0.0);
+ stored_channels(adj, ColorMode::Lab, depth, &mut n);
lab_denorm(n)
}),
Adjustment::Threshold { level } => {
@@ -1993,6 +2033,53 @@ mod tone_tests {
assert!(near(in_cmyk(&t, [0.8; 3]), cmyk_to_rgb([0.0; 4]), 2e-3));
}
+ #[test]
+ fn cmyk_threshold_compares_the_inks_plain_luma() {
+ assert_eq!(ink_luma([0.0; 4]), 1.0);
+ assert_eq!(ink_luma([0.0, 0.0, 0.0, 1.0]), 0.0);
+ // Two greys either side of level 128 in photoshop corpus cmyk8 threshold-128.psd: black,
+ // then white (8-bit inks).
+ let at = |i: [f32; 4]| {
+ let mut ch = i.map(|v| v / 255.0);
+ stored_channels(&Adjustment::Threshold { level: 128.0 / 255.0 }, ColorMode::Cmyk, Some(SampleType::U8), &mut ch);
+ ch
+ };
+ assert_eq!(at([144.0, 122.0, 121.0, 35.0]), [0.0, 0.0, 0.0, 1.0]);
+ assert_eq!(at([131.0, 110.0, 110.0, 19.0]), [0.0; 4]);
+ }
+
+ #[test]
+ fn cmyk_brightness_contrast_curves_each_ink_from_paper() {
+ use photocraft_color::convert::{cmyk_to_rgb, rgb_to_cmyk};
+ // The tone curve runs on each ink's stored value, 1 - ink (photoshop corpus cmyk8
+ // brightness-contrast.psd and -legacy.psd): raising brightness takes ink away, and paper
+ // and solid ink stay put.
+ let red = [0.9, 0.2, 0.1];
+ for legacy in [false, true] {
+ let adj = Adjustment::BrightnessContrast { brightness: 25.0, contrast: 30.0, legacy };
+ let table = ink_brightness_contrast_lut(25.0, 30.0, legacy);
+ let want = cmyk_to_rgb(rgb_to_cmyk(red).map(|v| 1.0 - lut(&table, 1.0 - v)));
+ assert!(near(in_cmyk(&adj, red), want, 2e-3), "legacy {legacy}");
+ assert!(near(in_cmyk(&adj, [1.0; 3]), [1.0; 3], 2e-3), "legacy {legacy}: paper");
+ let solid = cmyk_to_rgb([1.0; 4]);
+ assert!(near(in_cmyk(&adj, solid), cmyk_to_rgb(rgb_to_cmyk(solid).map(|v| ink_through(&table, v))), 2e-3));
+ }
+ // Legacy +25 / +30 on Photoshop's own 16-bit inks (photoshop corpus cmyk16
+ // brightness-contrast-legacy.psd): contrast pivots at 128 in ink, 127 stored.
+ let legacy = ink_brightness_contrast_lut(25.0, 30.0, true);
+ for (ink, ps) in [(139.0, 108.0), (160.0, 137.99), (172.0, 155.13), (183.0, 170.85), (196.0, 189.42), (98.0, 49.42), (128.0, 92.28), (168.0, 149.42)] {
+ let got = ink_through(&legacy, ink / 255.0) * 255.0;
+ assert!((got - ps).abs() < 0.1, "ink {ink}: {got} vs Photoshop {ps}");
+ }
+ let brighter = Adjustment::BrightnessContrast { brightness: 60.0, contrast: 0.0, legacy: false };
+ let ink = ink_brightness_contrast_lut(60.0, 0.0, false);
+ assert!(ink_through(&ink, 0.5) < 0.5 && ink_through(&ink, 0.0) == 0.0 && (ink_through(&ink, 1.0) - 1.0).abs() < 1e-6);
+ // On the screen colour it would land elsewhere.
+ let mut rgb = Buffer::filled(crate::Rect::new(0, 0, 1, 1), [red[0], red[1], red[2], 1.0]);
+ apply(&brighter, &mut rgb);
+ assert!(!near(in_cmyk(&brighter, red), [rgb.px[0][0], rgb.px[0][1], rgb.px[0][2]], 0.01));
+ }
+
#[test]
fn lab_posterize_steps_l_a_and_b() {
let got = in_lab(&Adjustment::Posterize { levels: 2 }, lab(70.0, 20.0, -30.0));
diff --git a/crates/engine/src/pixels.rs b/crates/engine/src/pixels.rs
index b2641a5c1..bfc76eba4 100644
--- a/crates/engine/src/pixels.rs
+++ b/crates/engine/src/pixels.rs
@@ -122,7 +122,14 @@ pub fn adjust_mask(s: &mut Surface, adj: &Adjustment, selection: Option<&Surface
fn adjusted(s: &Surface, r: Rect, adj: &Adjustment, selection: Option<&Surface>, mode: photocraft_color::ColorMode) -> Vec<f32> {
let fmt = s.format();
if fmt.mode == mode && matches!(mode, photocraft_color::ColorMode::Lab | photocraft_color::ColorMode::Cmyk) && adjust::stored_channel_adjustment(adj) {
- return adjusted_channels(s, r, adj, selection);
+ return adjusted_channels(s, r, selection, |ch| adjust::stored_channels(adj, fmt.mode, Some(fmt.sample), ch));
+ }
+ if let Adjustment::BrightnessContrast { brightness, contrast, legacy } = adj
+ && fmt.mode == mode
+ && mode == photocraft_color::ColorMode::Cmyk
+ {
+ let table = adjust::ink_brightness_contrast_lut(*brightness, *contrast, *legacy);
+ return adjusted_channels(s, r, selection, |ch| ch.iter_mut().for_each(|v| *v = adjust::ink_through(&table, *v)));
}
let n = fmt.channels();
let raw = s.read_region(r);
@@ -135,10 +142,10 @@ fn adjusted(s: &Surface, r: Rect, adj: &Adjustment, selection: Option<&Surface>,
mix_through_selection(&fmt, r, &orig.px, &buf.px, selection)
}
-/// [`adjusted`] for an adjustment Photoshop applies to a Lab or CMYK layer's own channels
-/// (`adjust::stored_channels`): exact on the stored values, with no trip through RGB, and mixed
-/// through the selection on those values (alpha untouched).
-fn adjusted_channels(s: &Surface, r: Rect, adj: &Adjustment, selection: Option<&Surface>) -> Vec<f32> {
+/// [`adjusted`] for an adjustment Photoshop applies to a Lab or CMYK layer's own channels: `op`
+/// changes one pixel's colour channels, exact on the stored values with no trip through RGB, and
+/// the selection mixes those values (alpha untouched).
+fn adjusted_channels(s: &Surface, r: Rect, selection: Option<&Surface>, op: impl Fn(&mut [f32])) -> Vec<f32> {
let fmt = s.format();
let (n, colors) = (fmt.channels(), fmt.mode.color_channels());
let mut raw = s.read_region(r);
@@ -152,13 +159,11 @@ fn adjusted_channels(s: &Surface, r: Rect, adj: &Adjustment, selection: Option<&
if k <= 0.0 {
continue;
}
- let p = to_rgba(&fmt, px);
- let gray = photocraft_color::convert::rgb_to_gray([p[0], p[1], p[2]]);
let Some(ch) = px.get_mut(..colors) else { continue };
let mut out = [0.0f32; 4];
let Some(out) = out.get_mut(..colors) else { continue };
out.copy_from_slice(ch);
- adjust::stored_channels(adj, fmt.mode, Some(fmt.sample), out, gray);
+ op(out);
for (v, o) in ch.iter_mut().zip(out.iter()) {
*v += (o - *v) * k;
}
diff --git a/crates/engine/src/pixels_tests.rs b/crates/engine/src/pixels_tests.rs
index 965544307..13b63a6a3 100644
--- a/crates/engine/src/pixels_tests.rs
+++ b/crates/engine/src/pixels_tests.rs
@@ -349,3 +349,26 @@ fn invert_posterize_and_threshold_change_lab_and_cmyk_channels_as_stored() {
assert_levels(&adjusted_pixel(lab8, &f([128.0, 30.0, 220.0, 255.0]), &level, None), &[255.0, 128.0, 128.0, 255.0], "Lab threshold light");
assert_levels(&adjusted_pixel(lab16, &f([127.0, 30.0, 220.0, 255.0]), &level, None), &[0.0, 128.0, 128.0, 255.0], "Lab threshold dark");
}
+
+/// Image › Adjustments › Brightness/Contrast on a CMYK layer curves each stored ink value
+/// (1 - ink) exactly, modern and legacy, and a selection mixes the stored inks.
+#[test]
+fn brightness_contrast_curves_cmyk_inks_as_stored() {
+ let cmyk = PixelFormat::new(ColorMode::Cmyk, SampleType::U16, true);
+ let ink = [0.2, 0.4, 0.6, 0.1, 1.0];
+ for legacy in [false, true] {
+ let adj = Adjustment::BrightnessContrast { brightness: 25.0, contrast: 30.0, legacy };
+ let table = adjust::ink_brightness_contrast_lut(25.0, 30.0, legacy);
+ let got = adjusted_pixel(cmyk, &ink, &adj, None);
+ for c in 0..4 {
+ let want = adjust::ink_through(&table, ink[c]);
+ assert!((got[c] - want).abs() < 1e-4, "legacy {legacy} ink {c}: {} vs {want}", got[c]);
+ }
+ assert_eq!(got[4], 1.0);
+ let half = adjusted_pixel(cmyk, &ink, &adj, Some(0.5));
+ for c in 0..4 {
+ let want = ink[c] + (adjust::ink_through(&table, ink[c]) - ink[c]) * 128.0 / 255.0;
+ assert!((half[c] - want).abs() < 1e-3, "legacy {legacy} ink {c} through half a selection");
+ }
+ }
+}
diff --git a/crates/gpu/src/plan.rs b/crates/gpu/src/plan.rs
index 96853217d..de2003c1e 100644
--- a/crates/gpu/src/plan.rs
+++ b/crates/gpu/src/plan.rs
@@ -1832,8 +1832,8 @@ mod tests {
for mode in [ColorMode::Rgb, ColorMode::Grayscale] {
assert!(adjustment_on_gpu(adj, mode), "{adj:?} in {mode:?}");
}
- // CMYK documents invert, posterize and threshold their inks, on the CPU.
- let inks = matches!(adj, Adjustment::Invert | Adjustment::Posterize { .. } | Adjustment::Threshold { .. });
+ // CMYK documents invert, posterize, threshold and brighten their inks, on the CPU.
+ let inks = !matches!(adj, Adjustment::GradientMap { .. });
assert_eq!(adjustment_on_gpu(adj, ColorMode::Cmyk), !inks, "{adj:?} in CMYK");
}
// Screen-colour adjustments stay on the GPU in Lab documents.
diff --git a/docs/file-format-parity.md b/docs/file-format-parity.md
index 0efb5bbd0..69cbba163 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 (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
+> **Last reviewed:** 2026-10-12 · **Last updated:** 2026-10-13 · **Change:** minor (CMYK Brightness/Contrast on the inks, CMYK Threshold's luma; 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,8 @@ remaining gaps in #1606 stay tracked with per-sample corpus ceilings.
| Date | Change | Summary |
|---|---|---|
+| 2026-10-13 | minor | CMYK Threshold compares the Rec. 601 luma of the inks' plain complement, as Photoshop does (every pixel of cmyk8/16 threshold-128.psd); oracle bad pixels 1.6% → 0.2% |
+| 2026-10-13 | minor | CMYK Brightness/Contrast (modern and legacy) curves each ink's stored value (1 − ink), exact on destructive edits; cmyk8/16 oracle bad pixels 71% → 48–57% (the RGB composite's separation still differs) |
| 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 |
diff --git a/docs/gaps.md b/docs/gaps.md
index e66b9a32b..0be2319ed 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: 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
+> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-13 · **Change:** minor (G1: CMYK Brightness/Contrast on the inks, CMYK Threshold's luma; 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,8 @@ what an agent can't finish alone.
| Date | Change | Summary |
|---|---|---|
+| 2026-10-13 | minor | CMYK Threshold compares the Rec. 601 luma of the inks' plain complement, as Photoshop does (every pixel of cmyk8/16 threshold-128.psd); oracle bad pixels 1.6% → 0.2% |
+| 2026-10-13 | minor | G1: CMYK Brightness/Contrast (modern and legacy) curves each ink's stored value as Photoshop does; oracle bad pixels 71% → 48–57%, floor unchanged |
| 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 |