LightCraft: An open-source non-destructive photo editor written by scratch in pure Rust
Merge PR #1770
Brandon Thomas133d575b8a49
diff --cc crates/raw/src/vendor/nef.rsindex 3489c57b0,62926aee5..745375087--- a/crates/raw/src/vendor/nef.rs+++ b/crates/raw/src/vendor/nef.rs@@@ -101,68 -88,28 +102,85 @@@ struct MeasuredBody/// the masked-column test keeps them and they develop as a pink band on the right. The camera's 4288 × 2848 JPEG/// sits at (10, 10). Green saturates at 3840–3851 while red and blue run on to 4095; one level of 3830 keeps/// clipped highlights white.+/// * **NIKON D7000** and **NIKON D5100** (and the Coolpix A, the same readout): the data is 4992 × 3280, the picture its+/// first 4948 columns, then 36 masked ones at one level (~600, with a black level of 0) and 8 of 0. The masked+/// columns sit above the dark-column trim's threshold, so without this area they show as a coloured bar on the right+/// edge (the top in portrait; issue #976). The camera's 4928 × 3264 JPEG sits at (8, 8): in the D5100's 3 CC0+/// samples, and in the D7000's one clean one, with the D5100 and Coolpix A as siblings (see below).+/// * **The other bodies** below keep masked or dark lines inside the whole data (the survey in `docs/nikon-bodies.md`):+/// each crop is its camera JPEG's frame as `cargo xtask raw-frame` measures it on raw.pixls.us CC0 samples, with at+/// least 3 clean files agreeing: of the model (bit depths pooled: both read out the same area), or, with at least+/// one of its own, together with models of the same readout (data and JPEG size) that agree on the same frame+/// (*siblings*). The D4's 12-bit mode reads out the 14-bit area measured above; the Df, the same readout, agrees on+/// (8, 6) in 6 files. Bodies whose crop holds only picture beyond the camera frame have no entry (no change).+ /// * **NIKON D5000** (issue #1627; 2 CC0 compressed 12-bit NEFs from raw.pixls.us): the D90's sensor, with the+ /// same 4352 × 2868 data and the same flat ~255 filler from column 4310, which shows as a band on the right. Both+ /// samples had Auto Distortion Control on, which warps their JPEGs around the centre, so only the centre aligns:+ /// a 200 px patch there sits where the D90's area puts it, (10, 10), on both. Green tops out at the D90's 3840.+ /// * **NIKON D600 and D610** (issue #1627; 4 CC0 NEFs of each from raw.pixls.us, 12- and 14-bit, lossless and+ /// lossy): the data is 6080 × 4028. Columns 6034–6041 are filler at a flat 150 (12-bit) or 601 (14-bit),+ /// 6042–6047 hold noise up to the top of the range, and only the last 32 are dark, so the masked-column test keeps+ /// the first 14 and they develop as a bright band on the right. The camera's 6016 × 4016 JPEG sits at (8, 6) in+ /// all 8 files. The noise columns also read as a saturation plateau: the white measured from the whole data came+ /// out at 3174–3182 (12-bit) and 12707–12729 (14-bit) on the D600's files while their pictures reach 3450–3731 and+ /// 14902–16308, so their brightest samples were cut off as clipped. Measured inside the image area it is the+ /// data's top, or the real plateau where the picture clips (4080 and 16320 on the D610's).const MEASURED_BODIES: &[MeasuredBody] = &[MeasuredBody { model: "NIKON D4", size: (4992, 3292), bits: 14, crop: (8, 6, 4928, 3280), white: Some(15520.0) },MeasuredBody { model: "NIKON D7100", size: (6036, 4020), bits: 14, crop: (18, 10, 6000, 4000), white: None },MeasuredBody { model: "NIKON D7100", size: (4812, 3212), bits: 14, crop: (6, 6, 4800, 3200), white: None },MeasuredBody { model: "NIKON D90", size: (4352, 2868), bits: 12, crop: (10, 10, 4288, 2848), white: Some(3830.0) },+ MeasuredBody { model: "NIKON D4", size: (4992, 3292), bits: 12, crop: (8, 6, 4928, 3280), white: None },+ MeasuredBody { model: "NIKON D7000", size: (4992, 3280), bits: 14, crop: (8, 8, 4928, 3264), white: None },+ MeasuredBody { model: "NIKON D7000", size: (4992, 3280), bits: 12, crop: (8, 8, 4928, 3264), white: None },+ MeasuredBody { model: "NIKON D5100", size: (4992, 3280), bits: 14, crop: (8, 8, 4928, 3264), white: None },+ // siblings: D7000 (4), D5100 (3); masked: right 36+ MeasuredBody { model: "COOLPIX A", size: (4992, 3280), bits: 14, crop: (8, 8, 4928, 3264), white: None },+ // 6 files each; masked: left 2, right 2+ MeasuredBody { model: "NIKON D3", size: (4288, 2844), bits: 12, crop: (15, 6, 4256, 2832), white: None },+ MeasuredBody { model: "NIKON D3", size: (4288, 2844), bits: 14, crop: (15, 6, 4256, 2832), white: None },+ MeasuredBody { model: "NIKON D3S", size: (4288, 2844), bits: 12, crop: (15, 6, 4256, 2832), white: None },+ MeasuredBody { model: "NIKON D3S", size: (4288, 2844), bits: 14, crop: (15, 6, 4256, 2832), white: None },+ MeasuredBody { model: "NIKON D700", size: (4288, 2844), bits: 12, crop: (15, 6, 4256, 2832), white: None },+ MeasuredBody { model: "NIKON D700", size: (4288, 2844), bits: 14, crop: (15, 6, 4256, 2832), white: None },+ // 6 and 4 files; masked: right up to 32+ MeasuredBody { model: "NIKON D300", size: (4352, 2868), bits: 12, crop: (15, 10, 4288, 2848), white: None },+ MeasuredBody { model: "NIKON D300", size: (4352, 2868), bits: 14, crop: (15, 10, 4288, 2848), white: None },+ MeasuredBody { model: "NIKON D300S", size: (4352, 2868), bits: 12, crop: (15, 10, 4288, 2848), white: None },+ MeasuredBody { model: "NIKON D300S", size: (4352, 2868), bits: 14, crop: (15, 10, 4288, 2848), white: None },+ // D2X (1) and D2Xs (2) as siblings; dark: right 1+ MeasuredBody { model: "NIKON D2Xs", size: (4320, 2868), bits: 12, crop: (16, 10, 4288, 2848), white: None },+ // D3000, D40X, D60, D80: one file each, siblings; masked: right 4, bottom 3+ MeasuredBody { model: "NIKON D3000", size: (3904, 2616), bits: 12, crop: (14, 9, 3872, 2592), white: None },+ MeasuredBody { model: "NIKON D40X", size: (3904, 2616), bits: 12, crop: (14, 9, 3872, 2592), white: None },+ MeasuredBody { model: "NIKON D60", size: (3904, 2616), bits: 12, crop: (14, 9, 3872, 2592), white: None },+ MeasuredBody { model: "NIKON D80", size: (3904, 2616), bits: 12, crop: (14, 9, 3872, 2592), white: None },+ // 3 files; dark: bottom 4+ MeasuredBody { model: "NIKON D4S", size: (4936, 3288), bits: 12, crop: (4, 4, 4928, 3280), white: None },+ MeasuredBody { model: "NIKON D4S", size: (4936, 3288), bits: 14, crop: (4, 4, 4928, 3280), white: None },+ // 4 files; dark: bottom up to 4+ MeasuredBody { model: "NIKON D5600", size: (6016, 4016), bits: 12, crop: (8, 8, 6000, 4000), white: None },+ MeasuredBody { model: "NIKON D5600", size: (6016, 4016), bits: 14, crop: (8, 8, 6000, 4000), white: None },+ // 4 files each; masked: right 8+ MeasuredBody { model: "NIKON D600", size: (6080, 4028), bits: 12, crop: (8, 6, 6016, 4016), white: None },+ MeasuredBody { model: "NIKON D600", size: (6080, 4028), bits: 14, crop: (8, 6, 6016, 4016), white: None },+ MeasuredBody { model: "NIKON D610", size: (6080, 4028), bits: 12, crop: (8, 6, 6016, 4016), white: None },+ MeasuredBody { model: "NIKON D610", size: (6080, 4028), bits: 14, crop: (8, 6, 6016, 4016), white: None },+ // D800: 6 files; D800E: 2, with the D800 as sibling; masked: right 14 (issue #914, the top in portrait)+ MeasuredBody { model: "NIKON D800", size: (7424, 4924), bits: 12, crop: (8, 6, 7360, 4912), white: None },+ MeasuredBody { model: "NIKON D800", size: (7424, 4924), bits: 14, crop: (8, 6, 7360, 4912), white: None },+ MeasuredBody { model: "NIKON D800E", size: (7424, 4924), bits: 14, crop: (8, 6, 7360, 4912), white: None },+ // 3 files; dark: bottom 1+ MeasuredBody { model: "NIKON D810", size: (7380, 4928), bits: 12, crop: (12, 8, 7360, 4912), white: None },+ MeasuredBody { model: "NIKON D810", size: (7380, 4928), bits: 14, crop: (12, 8, 7360, 4912), white: None },+ // 6 files; masked: left 2, right 42 (the D4's readout)+ MeasuredBody { model: "NIKON Df", size: (4992, 3292), bits: 12, crop: (8, 6, 4928, 3280), white: None },+ MeasuredBody { model: "NIKON Df", size: (4992, 3292), bits: 14, crop: (8, 6, 4928, 3280), white: None },+ MeasuredBody { model: "NIKON D5000", size: (4352, 2868), bits: 12, crop: (10, 10, 4288, 2848), white: Some(3830.0) },+ MeasuredBody { model: "NIKON D600", size: (6080, 4028), bits: 12, crop: (8, 6, 6016, 4016), white: None },+ MeasuredBody { model: "NIKON D600", size: (6080, 4028), bits: 14, crop: (8, 6, 6016, 4016), white: None },+ MeasuredBody { model: "NIKON D610", size: (6080, 4028), bits: 12, crop: (8, 6, 6016, 4016), white: None },+ MeasuredBody { model: "NIKON D610", size: (6080, 4028), bits: 14, crop: (8, 6, 6016, 4016), white: None },];fn measured_body(model: &str, w: usize, h: usize, bits: u32) -> Option<&'static MeasuredBody> {diff --cc docs/parity-checklist.mdindex ac14ed41a,21f16af76..ee05a4f55--- a/docs/parity-checklist.md+++ b/docs/parity-checklist.md@@@ -797,12 -790,7 +797,13 @@@ Latin stays upright. Advanced Japanese| Date | Change | Summary ||---|---|---|+| 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/raw-parity.mdindex af9889989,d50cb0c52..3c514e060--- a/docs/raw-parity.md+++ b/docs/raw-parity.md@@@ -276,9 -272,7 +276,10 @@@ Beyond decoding| Date | Change | Summary ||---|---|---|+| 2026-10-13 | minor | Bundled camera profiles 4 → 5 (ILCA-99M2) |+| 2026-10-14 | minor | 21 Sony and Leica models verified (one CC0 raw.pixls.us file each, pinned; `sony_leica_corpus.rs`): 258 verified, 920 unverified; Leica on a verified body 21% → 72%, Sony 91% → 92%, use-weighted 85% and 43% |+| 2026-10-14 | minor | 17 uncompressed Olympus and Samsung models verified on one CC0 file each (`olympus_samsung_corpus.rs`): 254 verified, 932 unverified, 224 preview; OM / Olympus 3% → 6% (5% on verified bodies); use-weighted 85% and 42% unchanged; duplicated summary rows from a merge removed |+ | 2026-10-14 | minor | Nikon D600 and D610 image area (6016 × 4016 at 8, 6) measured on 4 CC0 NEFs of each, and the D90's area and white level applied to the D5000 (same sensor and filler, 2 CC0 NEFs): the filler and noise columns on the right no longer develop as a band, and for these bodies the white level is measured inside the image area, issue #1627 || 2026-10-11 | minor | Leica Q3 verified by a recorded check of 38 private DNGs (no decode failure; mean ΔE to the camera JPEG 6.3–13.9): 236 verified, 941 unverified, Leica bucket on a verified body 5% → 21%, weighted shares unchanged || 2026-10-12 | patch | CR2 white level from the active area, not the saturated masked rows above it (#1272: EOS 50D, 60D, 450D (Rebel XSi), 500D (Rebel T1i), 550D (Rebel T2i), 1200D (Rebel T5) and 100D (Rebel SL1)); scores unchanged || 2026-10-12 | minor | Canon PowerShot G9: as-shot white balance from WBInfo (`0x0029`, the row of the preset in ShotInfo), issue #1273; render unchanged (the camera-look fit already absorbed it), As Shot now the camera's; counts unchanged |diff --cc docs/whats-new.mdindex 1419d4148,c18b55313..4340ce27b--- a/docs/whats-new.md+++ b/docs/whats-new.md@@@ -1,103 -1,14 +1,110 @@@# What's new in LightCraft+## 2026-10-15++### Lightroom radial masks on the right side+- Radial masks brought over from Lightroom Classic (catalog import, XMP sidecars, edits inside DNGs and presets) now+ apply their effect inside the circle, as Lightroom does, instead of outside it (issue #1815). A mask inverted in+ Lightroom stays inverted, and older Radial Filters keep their Effect Outside / Invert Mask setting. Photos imported+ before this keep the masks they got: Photo ▸ Read Metadata from File reads a sidecar's again.++## 2026-10-15++### Delete in an album removes from the album only+- In an album, the Delete key now takes the selected photos out of the album, as in Lightroom. It used to move them+ to Recently Deleted, so they also left their folder's view (issue #1805). They stay in the library and in their+ folder; Edit ▸ Undo puts them back in the album. Photo ▸ Remove from Album does the same and now shows the key.+ To delete photos from the library from an album, use Photo ▸ Delete Photo or right-click ▸ Delete Photo. In a smart+ album, Delete changes nothing: its rules decide what it shows.+## 2026-10-14+### HDR merges of moving lights, and many brackets at once+- A star, the moon or a light that moves between the photos of a bracket (a night bracket on a tripod) no longer+ leaves a black hole where the middle photo had it clipped. With Deghost, the brightest photo's copy of it in a+ dark sky is now removed too.+- Photo ▸ Photo Merge ▸ HDR for Each Bracket Set merges every bracket among the selected photos with the last HDR+ settings, one after the other: each stack, and photos taken less than a second apart at different exposures.+ From the command line: `lightcraft-cli merge hdr-batch FOLDER`.+- Merging uses about a quarter less memory: three 67 MP raws need 3.8 GB instead of 4.8 GB.++### XMP sidecars catch up after a network share comes back+- With automatic XMP writing on, an edit to a photo whose folder can't be written (a network share that dropped+ out, a folder that went read-only) used to be written only to the library, with a line in the log, so the sidecar+ stayed behind the edit. LightCraft now says once that the sidecars are waiting, tries again every few seconds once+ the files are reachable, and says when they're written. `library.retrySidecars` does it on request.++### Reliability+- A damaged or crafted raw can no longer make LightCraft set aside gigabytes of memory before finding out the file is+ bad (issue #1512): a compressed PEF whose data is too short for the size it declares, an uncompressed TIFF-based+ raw whose tile claims far more samples than it holds, and an ARW6 with a broken tile are refused first. All 74+ files in the test corpus still decode.++### Reliability+- Thumbnails and previews are written to the cache on disk by one background writer instead of a new thread for+ each image (issue #1522). When renders come in faster than the disk takes them, at most 128 MB of images wait;+ past that a write is skipped (the image stays in memory and is written by a later render), so a slow disk can't+ pile up threads and memory.++### Reliability+- Saving the catalog and resuming a model download no longer write through a link left at the temporary file's+ name (`catalog.snap.tmp`, `model.onnx.part`): the link is removed and a new file made in its place, so the file it+ pointed to is never changed (issue #1502).++### Reliability+- A photo whose file was replaced (Reload Changed Files after an outside edit) no longer keeps the faces recognition+ made from the old pixels: they are made again from the new file, and a scan still busy with the old file when it+ changed doesn't put its faces on the new one (issue #1524).++### Settings stays put when you change tabs+- The Settings window keeps its top edge and width when you switch tabs, so the tab row no longer jumps around+ under the pointer. It used to be centred, so every tab of a different height moved it.++### Layout image over the loupe+- View ▸ Loupe Overlay ▸ Choose Layout Image… draws a PNG with transparency over the photo in the loupe, such as+ a magazine cover's masthead and cover lines, so you can frame a shot for the page it is made for. It fits inside+ the photo, follows zoom and pan, and ⌥⌘O shows or hides it. The same menu sets its opacity and a matte that+ darkens the photo outside it. The layout stays chosen across launches.++### Smaller JPEG exports+- JPEG exports are 12–14 % smaller at the same quality, with exactly the same pixels (issue #1373): each file now+ carries Huffman tables made for its own picture instead of the standard example tables. Every viewer opens them+ as before.++### Reliability+- A photo whose Defringe amount was stored far past the sliders' 20 (in a damaged catalog or sidecar) no longer+ crashes LightCraft each time it renders: the amount acts as 20.++### Lens names for Nikon DSLR raws+- Photos from Nikon DSLRs like the D700, D750, D80 or D5300 now show which lens they were taken with, for example+ "24.0-70.0 mm f/2.8". Those cameras don't write a lens name, so the lens field was empty and you couldn't filter or+ search by lens. LightCraft now reads the lens range Nikon keeps in its own maker note, the way Lightroom shows a+ lens it doesn't have a name for. Newly imported photos show it.++### Import when a card is connected+- Settings → Import → Cameras and Cards has an option to open the import review as soon as a camera or memory card+ is connected, the same review File → Import from Device opens. It's off by default. A card that's already in when+ LightCraft starts doesn't ask, and if a dialog is open or an import is running it waits until that's done.++### Local folders+- Photos deleted (or moved) by another app no longer stay in a Local folder, failing to load and logging an error+ each time you look (issue #1392): the next time you browse the folder, in a later session, they're left out. A photo you had rated, flagged or+ edited stays, marked missing, so its changes aren't lost; photos in My Photos are unchanged.++### Full-resolution panoramas+- Panorama and HDR Panorama merges keep the resolution of their photos instead of stopping at 40 megapixels+ (issue #1455), up to 512 MP and 65,000 pixels on the long edge, as in Lightroom. When the full size needs more+ memory than the computer has, the panorama is made as large as fits (five 51 MP photos: up to 166 MP with+ 16 GB, 355 MP with 32 GB) and the message says so. The merge also frees each photo's pixels once they are+ projected, so it needs less memory than before at any size (an 81 MP stitch: 4.4 GB instead of 6.2 GB).++ ### Nikon D600, D610 and D5000+ - Raws from the Nikon D600, D610 and D5000 no longer show a bright line down the right edge (issue #1627). Their+ sensor data runs a few columns of filler past the picture, which stayed in the image; these bodies now develop+ at the camera JPEG's size (6016 × 4016 for the D600 and D610, 4288 × 2848 for the D5000, as the D90 already+ did). On the D600 and D610 the white level is also measured inside the picture, so the filler can't pass for+ clipped highlights.+### Hard-edged Heal and Clone spots- 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.