LightCraft: An open-source non-destructive photo editor written by scratch in pure Rust
Merge PR #1614
Brandon Thomas3c0300fcbbaf
diff --cc crates/merge/src/hdr.rsindex 95750ba0b,e6b37a1d3..912766d2c--- a/crates/merge/src/hdr.rs+++ b/crates/merge/src/hdr.rs@@@ -9,14 -10,13 +10,15 @@@//! measured robustly — the median of log ratios over pixels well exposed in both — and chained//! to the reference; EXIF is the fallback when too few pixels overlap. Radiance//! `Rᵢ = vᵢ / kᵢ` is expressed in reference units.- //! 4. **Weights.** `wᵢ = kᵢ · (1 − smoothstep(0.80·clip, 0.96·clip, max channel))`: longer- //! exposures get more weight (shot-noise optimal for a linear sensor), saturated pixels none- //! (all channels together, so a clipped channel never shifts colour). The darkest frame keeps a- //! tiny weight so fully saturated pixels still get a value. Where the reference is at or near its clip, the scene is+ //! 4. **Weights.** `wᵢ = kᵢ · (1 − smoothstep(0.80·clip, 0.96·clip, max channel within 1 px))`:+ //! longer exposures get more weight (shot-noise optimal for a linear sensor), saturated pixels+ //! none (all channels together, so a clipped channel never shifts colour), nor their neighbours,+ //! which demosaicing interpolated from clipped photosites. The darkest frame keeps a tiny weight-//! so fully saturated pixels still get a value.-//! 5. **Deghost** (None/Low/Medium/High): on a ≤ 1024 px version, a per-pixel consistency test-//! against the reference: the reference radiance (or, where the reference is clipped/too dark,++//! so fully saturated pixels still get a value. Where the reference is at or near its clip, the scene is+//! at least that bright: a frame reading far darker there saw something that moved (a star, the moon, a light) and is+//! left out, so a clipped highlight of the reference is never replaced by content from another moment.+//! 5. **Deghost** (None/Low/Medium/High): on a ≤ 2048 px version, a per-pixel consistency test+//! against the reference: the reference radiance (or, where the reference is clipped or black,//! the nearest well-exposed frame's) predicts what each frame should have recorded; frames that//! disagree by more than a threshold (in log units, with a noise floor) are masked there. Masks//! are dilated and feathered (Gaussian), upsampled, and remove the frame's weight. Their uniondiff --cc docs/merge.mdindex 50dd8e0af,876001a94..e3f3e71ad--- a/docs/merge.md+++ b/docs/merge.md@@@ -30,11 -25,11 +30,14 @@@ reference. Auto Align: features on expohomography (the simplest model that explains ≥ 97 % of the matches). Exposure ratios are measured(median log ratio of well-exposed pixels between brightness neighbours), EXIF is the fallback.Radiance is a weighted mean in linear light, weight `k · (1 − smoothstep(0.8·clip, 0.96·clip, max- channel))`. Where the reference is at or near its clip the scene is at least that bright, so a frame that reads far+ channel within 1 px))`: a pixel next to clipped photosites was demosaiced from them and reads low in the clipped+ channel, so it goes with them (on real ARW brackets the brightest frame's green was 3–5 % low there, and bright+ windows took a magenta tinge). The frames are taken in brightness order (ties by content), so the result doesn't-depend on the order they come in. Deghost: a per-pixel consistency test against the reference radiance (with a noise-floor), dilated and feathered masks; the union is the deghost overlay. Output: 16-bit float DNG.++depend on the order they come in. Where the reference is at or near its clip the scene is at least that bright, so a frame that reads far+darker there (an object moved: a star, the moon, a passing light) is left out and the clipped highlight stays (always+on: a moving star otherwise left a black hole). Deghost: a per-pixel consistency test on ≤ 2048 px versions against the+reference radiance (with a noise floor; the reference predicts down to 0.1 % of its clip, so a brighter frame's ghost in+a night sky is caught), dilated and feathered masks; the union is the deghost overlay. Output: 16-bit float DNG.Lens corrections: frames are merged uncorrected, and the DNG's `OpcodeList3` carries the reference frame's(`WarpRectilinear`, `WarpRectilinear2`, `FixVignetteRadial`: a DNG's own, or a camera's correction a raw readerconverts, e.g. Sony, Panasonic), re-expressed for its default crop (`Opcode::cropped`). So Optics ▸ Enable Lensdiff --cc docs/parity-checklist.mdindex ee05a4f55,d287cd865..a5d5bdd56--- a/docs/parity-checklist.md+++ b/docs/parity-checklist.md@@@ -353,10 -347,10 +353,10 @@@ differences and missing bindings are i| Id | Feature | Tier | Status | Evidence | Missing / notes ||---|---|---|---|---|---|- | LR-MERGE-HDR | HDR merge | P2 | 🟡 | `cmd:merge.hdr`, `cmd:dialog.mergeHdr`, `crates/merge/src/frame.rs` (`Frame::lens`), `crates/merge/src/hdr.rs` | auto align, deghost None–High + overlay, auto settings, float DNG, Create Stack; the DNG keeps the reference frame's embedded lens corrections (tested by `hdr_merge_keeps_the_reference_frames_lens_corrections`); raws without colour matrices of their own (CR2, NEF, ARW…) keep the colour they open with, written as DNG tags (`starting_colour_tags`; the look's chroma curve has no tag; panoramas too), issue #965. Tested on real Sony A7R VI brackets (67 MP, 2026-10-14): frames agree with the merged radiance within ~1 % in all channels, exposure steps match EXIF within 0.03 EV. A clipped highlight of the reference that moved in other frames (a star at 200 mm) stays instead of becoming a black hole, and deghost (≤ 2048 px maps) catches a brighter frame's ghost in a dark sky (`a_clipped_star_of_the_reference_is_not_erased_by_frames_where_it_moved`, `deghost_removes_a_bright_frames_ghost_in_a_dark_sky`). 🟡 because: AI Denoise doesn't run on merged DNGs (Bayer only; Lightroom's does), JPEG brackets are treated as linear (no camera response curve), and every frame is held as 32-bit float (~0.86 GB per 67 MP frame, so 7 frames need ~7 GB); gap 29 |-| LR-MERGE-HDR | HDR merge | P2 | ✅ | `cmd:merge.hdr`, `cmd:dialog.mergeHdr`, `crates/merge/src/frame.rs` (`Frame::lens`) | auto align, deghost None–High + overlay, auto settings, float DNG, Create Stack; the DNG keeps the reference frame's embedded lens corrections (tested by `hdr_merge_keeps_the_reference_frames_lens_corrections`); JPEG brackets treated as linear; the same result whatever order the frames come in (`merge_does_not_depend_on_the_frame_order`); pixels next to clipped ones lose their weight with them (`pixels_next_to_clipped_ones_do_not_tint_the_merge`); raws without colour matrices of their own (CR2, NEF, ARW…) keep the colour they open with, written as DNG tags (`starting_colour_tags`; the look's chroma curve has no tag; panoramas too), issue #965 |++| LR-MERGE-HDR | HDR merge | P2 | 🟡 | `cmd:merge.hdr`, `cmd:dialog.mergeHdr`, `crates/merge/src/frame.rs` (`Frame::lens`), `crates/merge/src/hdr.rs` | auto align, deghost None–High + overlay, auto settings, float DNG, Create Stack; the DNG keeps the reference frame's embedded lens corrections (tested by `hdr_merge_keeps_the_reference_frames_lens_corrections`); the same result whatever order the frames come in (`merge_does_not_depend_on_the_frame_order`); pixels next to clipped ones lose their weight with them (`pixels_next_to_clipped_ones_do_not_tint_the_merge`); raws without colour matrices of their own (CR2, NEF, ARW…) keep the colour they open with, written as DNG tags (`starting_colour_tags`; the look's chroma curve has no tag; panoramas too), issue #965. Tested on real Sony A7R VI brackets (67 MP, 2026-10-14): frames agree with the merged radiance within ~1 % in all channels, exposure steps match EXIF within 0.03 EV. A clipped highlight of the reference that moved in other frames (a star at 200 mm) stays instead of becoming a black hole, and deghost (≤ 2048 px maps) catches a brighter frame's ghost in a dark sky (`a_clipped_star_of_the_reference_is_not_erased_by_frames_where_it_moved`, `deghost_removes_a_bright_frames_ghost_in_a_dark_sky`). 🟡 because: AI Denoise doesn't run on merged DNGs (Bayer only; Lightroom's does), JPEG brackets are treated as linear (no camera response curve), and every frame is held as 32-bit float (~0.86 GB per 67 MP frame, so 7 frames need ~7 GB); gap 29 || LR-MERGE-PANO | Panorama | P2 | ✅ | `cmd:merge.panorama`, `cmd:dialog.mergePanorama` | spherical/cylindrical/perspective + auto, boundary warp, auto crop, fill edges (diffusion), DNG; no lens model / 360° wrap || LR-MERGE-HDRPANO | HDR panorama | P2 | ✅ | `cmd:merge.hdrPanorama`, `cmd:dialog.mergeHdrPanorama` | brackets grouped by EXIF |-| LR-MERGE-HEADLESS | Merge with last settings | P2 | ✅ | `cmd:merge.hdrLast`, `cmd:merge.panoramaLast`, `cmd:merge.hdrPanoramaLast` | no dialog; the options of the last merge of that kind (defaults the first time) |+| LR-MERGE-HEADLESS | Merge with last settings | P2 | ✅ | `cmd:merge.hdrLast`, `cmd:merge.panoramaLast`, `cmd:merge.hdrPanoramaLast`, `cmd:merge.hdrBatch`, `crates/catalog/src/stacks.rs` (`bracket_sets`) | no dialog; the options of the last merge of that kind (defaults the first time). HDR for Each Bracket Set merges a batch like Lightroom's merge of stacks: one HDR per stack among the photos, then per bracket (photos taken less than a second apart, after the shutter time, at exposures ≥ ½ EV apart; bursts at one exposure are skipped), one after the other in the activity stack (cancelling one stops the rest; a failed set doesn't); CLI `merge hdr-batch FILES…` |## P. Enhance (ENH)@@@ -797,13 -790,6 +797,14 @@@ Latin stays upright. Advanced Japanese| Date | Change | Summary ||---|---|---|++| 2026-10-14 | patch | LR-MERGE-HDR: the merge no longer depends on the order of its frames, and pixels next to clipped photosites lose their weight with them (no magenta fringes along clipped windows); status unchanged (🟡) |+| 2026-10-14 | minor | LR-IMP-CAMERA-COVERAGE: 17 uncompressed Olympus and Samsung Adobe models verified on one CC0 file each; status unchanged (🟡) |+| 2026-10-13 | minor | LR-EDIT-SECTION-SOLO: Solo Mode for Edit sections (Window ▸ Edit Sections, section-header menu, ⌥-click); KEYC-PANELS notes it |+| 2026-10-14 | minor | LR-MERGE-HDR ✅ → 🟡: tested on real 67 MP Sony brackets; moving clipped highlights (black-hole stars) and dark-sky ghosts fixed, merge memory cut ~25 %; AI Denoise on merged DNGs, JPEG response curves and per-frame memory remain (gap 29). LR-MERGE-HEADLESS, MENU-PHOTO-MERGE: HDR for Each Bracket Set (`merge.hdrBatch`) |+| 2026-10-15 | patch | LR-VIEW-BEFOREAFTER: side by side and stacked panes share click-zoom animation for whole-frame images, window tiles and input; render requests keep the final target (#1821); status unchanged |+| 2026-10-14 | patch | LR-META-XMP: automatic sidecar writes that fail (folder offline or read-only) wait and are written again once the files are reachable, with a notice (`cmd:library.retrySidecars`); status unchanged |+| 2026-10-13 | minor | LR-BEHAV-WINDOW (new, 🟡): the desktop app's window opens at the size it was left at, zoomed / maximized if it was; full screen and the place on the desktop are not remembered |+| 2026-10-14 | minor | LR-IMP-CAMERA-COVERAGE: Nikon D600, D610 and D5000 NEFs drop the filler and noise columns on the right (a band), and the D600 and D610 measure their white level inside the image (#1627); status unchanged (🟡) || 2026-10-13 | patch | LR-VIEW-COMPARE, LRC-LIB-COMPARE: ⌘/Ctrl- and Shift-clicks on the filmstrip in Compare change the selection as in the grid; the two photos shown stay selected and the active photo is unchanged (#187); statuses unchanged || 2026-10-13 | minor | KEYC-SELECTONLYACTIVE: Edit → Select Only Active Photo (⌘⇧D) lands as a new row; status 🟡 (headless-tested, native macOS menu path unverified) || 2026-10-13 | patch | LRC-LIB-CATALOG-IMPORT: a catalog whose tables are all still in its `-wal` file (main file schema format 0) opens instead of failing as an unsupported schema format; status unchanged |diff --cc docs/whats-new.mdindex 89a3b9672,68bcf9384..1c167fed5--- a/docs/whats-new.md+++ b/docs/whats-new.md@@@ -121,55 -6,15 +121,62 @@@- A spot with Feather at 0 no longer draws black pixels exactly on its radius. This also fixes spots at 0% Opacitychanging pixels along their edge. The hard edge now leaves pixels on the radius unchanged.+ ### Cleaner HDR merges+ - Bright windows in an HDR made with Photo ▸ Photo Merge ▸ HDR no longer take a magenta tinge from the brighter+ photos along the areas they clipped: right next to a clipped area, a photo's colour isn't used. It showed most when+ the highlights were darkened or saturated.+ - The same photos give the same HDR whatever order they are selected in; before, a different order could change a+ few pixels.++### HDR merges keep the white balance+- An HDR merged from raws that LightCraft colours from the camera's JPEG (CR2, NEF, ARW…) now opens at the same+ As Shot temperature and tint as its photos, and changing the white balance no longer turns it green. Sony ARW+ merges used to open at about 7000 K / +115 where the photos show 4000–5300 K / +8. HDRs merged before this keep+ their old white balance; merge them again.+## 2026-10-13+### Edits keep up in a large library+- A small edit (a keyword, a rating, a flag, a slider) no longer has the grid's list worked out again from every+ photo: only the photos the edit touched are asked about again and put at their place in the order. In a library of+ 67,000 photos that step went from 37 ms to under 1 ms. Still worked out whole: an edit to more than 256 photos, a+ change to an album, a stack or the keyword list, an album shown in its own order, Recently Added, Missing Photos,+ and a view that asks about "the last N days".+- With no filter set, the count of the source is taken from the list instead of from a second pass over the library.+- The side panels keep a tally an edit cannot have changed: a rating or a slider changes none of the folders,+ keywords, dates, people and counts; a keyword leaves the folders, the dates and the counts as they are. With both+ side panels open, the frame after a keyword went from about 156 ms to about 54 ms in that library (2 ms with the+ panels closed, from 71 ms).+- The count beside each smart album in the left panel follows an edit the same way: the album asks only the photos+ the edit touched, where it asked every photo of the library after each edit (about 25 ms an album in that library).+ With that, the frame after a keyword is at about 29 ms there. New rules, a change to an album or the keyword list,+ an edit to more than 256 photos, and each new minute for an album that asks about "the last N days" are still+ counted from every photo.+- Still tallied from every photo on each edit: the filter bar's lists of cameras, lenses and keywords.++### A view can hold its photos until you refresh it+- View ▸ Hold View Until Refreshed (off unless you turn it on; kept with the library). With it on, an edit that makes+ a photo stop matching the view keeps it in the view: a keyword given in a smart album of photos without keywords,+ a flag taken off in Picks, a rating that falls under the filter bar's. With it off, as before, the photo leaves the+ grid at once and every photo after it moves up. View ▸ Refresh View (also in the sort menu while the hold is on),+ Reshuffle, another source, filter or sort, or new rules for the smart album shows what matches now.+- Photos that start matching still appear at once, and deleting a photo or taking it out of the album or folder+ shown still takes it out of the view.++### The window opens at the size you left it+- LightCraft's window opens at the size it had when you last used it, and zoomed (macOS) / maximized if it was: it+ used to open at 1600 × 1000 every time. Double-click the top bar to zoom the window, quit, and it is zoomed when+ you come back; un-zoom it and it goes back to the size it had before.+- Full screen is not remembered (the app opens as a window), and neither is where on the desktop the window was:+ the system places it.+- On macOS the system does not tell LightCraft when a window is zoomed from the Window menu or resized after a+ zoom, so it goes by the window's size, and when in doubt takes the window for a window of the size it has: it+ comes back as large as you left it, but not as a zoomed window. That is so after a zoom from the Window menu+ with the Dock at a side of the screen, or of a window already as wide as the screen. Zoomed by a double-click+ on the top bar it comes back zoomed. The other way round, a window you drag out until it is as wide as the+ screen and nearly as tall counts as zoomed.+- For scripts: a size set with `ui.resize` is remembered like any other, so a script that needs a size sets it.+### HDR merges keep the lens correction- An HDR made with Photo ▸ Photo Merge ▸ HDR now keeps the lens correction the photos carry (Sony's, Panasonic'sand Leica's, and the one some DNGs carry, e.g. from drones): Optics ▸ Enable Lens Corrections straightens it as it