LightCraft: An open-source non-destructive photo editor written by scratch in pure Rust
LR-EDIT-OPTICS-PROFILE: a preset's LensProfileEnable=0 keeps embedded lens corrections
Exalted537309d5284e5ad7
diff --git a/crates/engine/src/crs.rs b/crates/engine/src/crs.rsindex d7cbe67f3..0d9b7a771 100644--- a/crates/engine/src/crs.rs+++ b/crates/engine/src/crs.rs@@ -298,9 +298,12 @@ pub fn to_partial(props: &Props, raw: Option<bool>) -> Value {n(o, "GrainSize", "grain.size");n(o, "GrainFrequency", "grain.roughness");- // ---- Optics (manual corrections; lens profiles are ours, only the switch carries over)- if let Some(b) = boolean(props, "crs:LensProfileEnable") {- put(o, "optics.lens_profile", json!(b));+ // ---- Optics (manual corrections; lens profiles are ours, only the switch carries over).+ // Our profile corrections are the file's own (DNG-embedded) ones, which Lightroom applies+ // whatever its "Enable Profile Corrections" box says [inferred]: so only an enabling switch+ // carries over, and `LensProfileEnable=0` (the default in most presets) leaves ours as it is.+ if boolean(props, "crs:LensProfileEnable") == Some(true) {+ put(o, "optics.lens_profile", json!(true));}if let Some(b) = boolean(props, "crs:AutoLateralCA") {put(o, "optics.remove_ca", json!(b));@@ -590,4 +593,16 @@ mod tests {let got = unmapped(&preset_packet(r#"crs:HDREditMode="1" crs:FutureSlider="12""#, used_points));assert_eq!(got, ["FutureSlider", "HDREditMode", "PointColors"]);}++ #[test]+ fn disabled_lens_profile_switch_keeps_embedded_corrections() {+ // Lightroom applies a file's built-in lens corrections regardless of its profile switch,+ // and ours are only those: a preset's `LensProfileEnable=0` must not turn them off+ let p = props(&preset_packet("", ""));+ let mut d = DevelopSettings::default();+ d.optics.lens_profile = true;+ assert!(apply_partial(&d, &to_partial(&p, None), 1.0).optics.lens_profile);+ let on = props(&preset_packet("", "").replace(r#"crs:LensProfileEnable="0""#, r#"crs:LensProfileEnable="1""#));+ assert!(apply_partial(&DevelopSettings::default(), &to_partial(&on, None), 1.0).optics.lens_profile);+ }}diff --git a/docs/parity.md b/docs/parity.mdindex 25d2ea9be..c8bc33dad 100644--- a/docs/parity.md+++ b/docs/parity.md@@ -265,7 +265,8 @@ under the UI command that wraps it (a no-op error); the UI command now wins.| LR-EDIT-DETAIL-SUPERRES | Super resolution | P2 | ⬜ | | || LR-EDIT-DETAIL-AISHARPEN | AI sharpen | OOS | 🚫 | | || LR-EDIT-OPTICS-CA | Remove chromatic aberration | P1 | ✅ | `crates/ui-egui/src/panels/edit.rs` (checkbox), `ctl:optics.caRed`, `ctl:optics.caBlue` | |-| LR-EDIT-OPTICS-PROFILE | Lens profile corrections | P1 | 🟡 | `ctl:optics.profileDistortion`, `ctl:optics.profileVignetting`, `crates/pipeline/src/optics.rs`, `crates/raw/src/vendor/rw2.rs` | uses corrections embedded in the file: DNG `WarpRectilinear` / `FixVignetteRadial`, and the camera's own distortion correction in Panasonic / Leica RW2 / RWL files (tag `0x0119`, read as the equivalent `WarpRectilinear`; on 79 photos from 13 bodies and 11 lenses the corrected render lines up with the camera JPEG within 0.75 px at 1440 px at the corners, from up to 13 % of the half diagonal uncorrected; issue #256); vignetting and lateral CA data of other raw formats (Olympus, Fujifilm, Sony) not read yet; no lens-profile database |+| LR-EDIT-OPTICS-PROFILE | Lens profile corrections | P1 | 🟡 | `ctl:optics.profileDistortion`, `ctl:optics.profileVignetting`, `crates/pipeline/src/optics.rs`, `crates/raw/src/vendor/rw2.rs`, `crates/engine/src/crs.rs` | uses corrections embedded in the file: DNG `WarpRectilinear` / `FixVignetteRadial`, and the camera's own distortion correction in Panasonic / Leica RW2 / RWL files (tag `0x0119`, read as the equivalent `WarpRectilinear`; on 79 photos from 13 bodies and 11 lenses the corrected render lines up with the camera JPEG within 0.75 px at 1440 px at the corners, from up to 13 % of the half diagonal uncorrected; issue #256); an imported preset's `LensProfileEnable=0` leaves them on, as Lightroom applies built-in corrections regardless (inferred); vignetting and lateral CA data of other raw formats (Olympus, Fujifilm, Sony) not read yet; no lens-profile database |+)| LR-EDIT-OPTICS-DEFRINGE | Defringe | P1 | ✅ | `ctl:optics.defringe*` | no fringe eyedropper || LR-EDIT-OPTICS-MANUAL | Manual distortion / vignetting | P1 | ✅ | `ctl:optics.distortion`, `ctl:optics.vignetting`, `ctl:optics.vignettingMidpoint` | || LR-EDIT-GEOM-UPRIGHT | Upright | P1 | ✅ | `cmd:geometry.upright`, `cmd:geometry.guides` | |diff --git a/docs/whats-new.md b/docs/whats-new.mdindex acf63a293..f128c9dbb 100644--- a/docs/whats-new.md+++ b/docs/whats-new.md@@ -47,6 +47,8 @@- 23 new built-in presets: Portrait, Landscape, Urban, Food, Seasons, Vintage and B&W toners.- Importing XMP presets no longer lists bookkeeping fields (`Cluster`, `SortName`, `SupportsAmount2`, the as-shotwhite, empty Point Color slots…) as settings that couldn't be carried over.+- A preset whose lens-profile switch is off no longer turns off the lens corrections built into a DNG (iPhone ProRAW+ and other files with embedded distortion / vignetting corrections), matching what the preset does elsewhere.- Imported `.cube` LUT profiles appear in the Profile menu and the profile browser, grouped by their folder, and stayfavourites across restarts (issue #328).@@ -85,6 +87,7 @@- Choosing a date under By Date or a keyword under Keywords shows those photos from All Photos, as their countspromise, instead of filtering whatever album or folder was open, which often showed nothing (issue #341).)+)### Reliability- If the desktop app can't open its window (for example when no graphics device can be used), it now says so in adiff --git a/docs/xmp-interop.md b/docs/xmp-interop.mdindex 32fc7e49f..85b41a958 100644--- a/docs/xmp-interop.md+++ b/docs/xmp-interop.md@@ -128,7 +128,7 @@ names are read (e.g. `Exposure2012`, not the older `Exposure`).| `PostCropVignetteAmount/Midpoint/Roundness/Feather/HighlightContrast` | `vignette.amount/midpoint/roundness/feather/highlights` | || `PostCropVignetteStyle` | `vignette.style` | 1 highlight priority, 2 colour priority, 3 paint overlay || `GrainAmount`, `GrainSize`, `GrainFrequency` | `grain.amount`, `grain.size`, `grain.roughness` | |-| `LensProfileEnable`, `AutoLateralCA` | `optics.lens_profile`, `optics.remove_ca` | the switch only; lens profiles are our own |+| `LensProfileEnable`, `AutoLateralCA` | `optics.lens_profile`, `optics.remove_ca` | lens profiles are the file's own (DNG-embedded) corrections, which Lightroom applies whatever its profile switch says (our inference): only `LensProfileEnable=1` carries over, `0` leaves the switch as it is || `LensManualDistortionAmount`, `VignetteAmount`, `VignetteMidpoint` | `optics.distortion`, `optics.vignetting`, `optics.vignetting_midpoint` | || `DefringePurple/GreenAmount/HueLo/HueHi` | `optics.defringe_*` | || `ShadowTint`, `RedHue/Saturation`, `GreenHue/Saturation`, `BlueHue/Saturation` | `calibration.shadows_tint`, `calibration.red_hue/red_sat`, … | Calibration panel, 1:1 |