Commit Graph
1826 Commits
Author SHA1 Message Date
Dylan M. Taylor 9de93337c5 Use shared HEIF metadata and preserve location checks (#4315) 2026-11-16 21:58:40 -05:00
FredApps 444dff540e Merge remote-tracking branch 'origin/main' into t4270b
# Conflicts:
#	packaging/linux/flatpak/cargo-sources.json
2026-11-16 09:10:10 +01:00
FredApps 7557fa5f78 Merge remote-tracking branch 'origin/main' into t4270b 2026-11-16 07:38:59 +01:00
FredApps e193b5daff Merge main and pin craft-plist to craft-libs#1633 merge 2026-11-16 06:58:21 +01:00
Dylan M. Taylor 829ed6f69a Delegate print PDF serialization to shared bounded raster writer 2026-11-15 17:53:24 -05:00
Dylan M. Taylor 478cb3bac6 Merge remote-tracking branch 'origin/main' into codex/light-plist-ci-refresh
# Conflicts:
#	Cargo.lock
#	crates/engine/Cargo.toml
2026-11-15 18:58:35 +00:00
Dylan M. Taylor 8a30374550 Merge remote-tracking branch 'origin/main' into feat/cutover-avif-jxl-tests
# Conflicts:
#	Cargo.lock
2026-11-15 18:47:45 +00:00
Dylan M. Taylor 116d3d6334 Retain Luminar date whitespace with shared XML policy 2026-11-15 11:24:34 -05:00
Dylan M. Taylor 3518393ce0 Delegate Luminar XML property lists to shared bounded reader 2026-11-15 11:23:32 -05:00
Dylan M. Taylor a14c333312 Reuse shared Base64 encoding for masks and image replies 2026-11-15 10:24:11 -05:00
Dylan M. Taylor 54d7531a73 Merge remote-tracking branch 'origin/main' into codex/lightcraft-av1-buffered-caller 2026-11-15 13:04:51 +00:00
Dylan M. Taylor 6afb3e1758 Merge remote-tracking branch 'origin/main' into codex/local-coverage-review-fix 2026-11-15 03:41:20 +00:00
Dylan M. Taylor ca4bbd2f94 test: extend slideshow waits under coverage 2026-11-15 03:40:48 +00:00
Dylan M. Taylor fea2efa39c fix(cutover): use craft-jxl decode limits by value 2026-11-14 22:25:33 +00:00
Dylan M. Taylor 5d22eff36c chore(codecs): cut over AVIF, AV1, and JXL tests to craft-libs 2026-11-14 21:19:39 +00:00
Dylan M. Taylor 25ffe3e5d4 codecs,raw,preview,meta,engine: cut over TIFF/JPEG/focus to craft-libs and fix CI (#4244)
* codecs,raw,preview,meta,engine: cut over TIFF/JPEG/focus to craft-libs and fix CI

* docs: update parity-checklist paths after craft-raw/craft-metadata cutover

* Remove unused codec workspace deps and cut examples over to craft-image-codecs

* chore: update Cargo.lock after removing unused codec deps
2026-11-14 13:49:38 -05:00
Dylan M. Taylor f028b6ff66 Merge remote-tracking branch 'origin/main' into codex/local-coverage-review-fix 2026-11-14 16:08:59 +00:00
FredApps a9ea230a1b fix: preserve existing UTF-8 source comments 2026-11-14 13:32:46 +01:00
FredApps e686c73109 fix: repair legacy shutter values in virtual copies 2026-11-14 13:32:20 +01:00
FredApps e2d1befd0b Merge branch 'main' into fix/1619-shutter-precision
# Conflicts:
#	docs/parity-checklist.md
2026-11-14 12:43:49 +01:00
Dylan M. Taylor 81d10df318 Merge remote-tracking branch 'origin/main' into codex/local-coverage-review-fix 2026-11-14 11:43:23 +00:00
FredApps 4c9211ccd6 Merge pull request #3982 from FredApps/fix/artcraft-feature-names-20261108
Naming: distinguish perspective controls from external feature names
2026-11-14 12:16:29 +01:00
Dylan M. Taylor 48a5de3276 test: import PSD before corrupting resources 2026-11-14 08:14:57 +00:00
Dylan M. Taylor 6f012c10b7 chore: finish craft-raw/craft-libs cutover after merge with main 2026-11-14 05:38:31 +00:00
Dylan M. Taylor 8a2f20f1ac Merge remote-tracking branch 'origin/main' into switch-lightcraft/wip-craft-raw
# Conflicts:
#	Cargo.lock
#	Cargo.toml
#	crates/codecs/Cargo.toml
#	crates/codecs/src/heif.rs
#	crates/codecs/src/psd.rs
#	crates/meta/Cargo.toml
#	crates/raw/Cargo.toml
#	crates/raw/src/dcp.rs
#	crates/raw/src/dng.rs
#	crates/raw/src/gaintable.rs
#	crates/raw/src/lib.rs
#	crates/raw/src/semantic.rs
#	crates/raw/src/vendor/arw6.rs
#	crates/raw/src/vendor/cr2.rs
#	crates/raw/src/vendor/cr2/sraw.rs
#	crates/raw/src/vendor/crw.rs
#	crates/raw/src/vendor/erf.rs
#	crates/raw/src/vendor/hasselblad.rs
#	crates/raw/src/vendor/kodak.rs
#	crates/raw/src/vendor/mef.rs
#	crates/raw/src/vendor/mrw.rs
#	crates/raw/src/vendor/nef.rs
#	crates/raw/src/vendor/nef_lens.rs
#	crates/raw/src/vendor/nefc.rs
#	crates/raw/src/vendor/pef.rs
#	crates/raw/src/vendor/srw.rs
2026-11-14 05:26:37 +00:00
Dylan M. Taylor 523f4418be test: fix timeout helper imports 2026-11-14 03:37:42 +00:00
Dylan M. Taylor 445efb07eb Merge remote-tracking branch 'origin/main' into codex/coverage-settle-budget 2026-11-14 03:33:08 +00:00
Dylan M. Taylor 0ee8704a29 test: extend coverage-only wait budgets 2026-11-14 03:29:32 +00:00
Dylan M. Taylor 9cd6817c3b codecs, meta: read PSD header and image resources with craft-psd (#4167) 2026-11-14 00:09:58 +00:00
FredApps 1f8e1ef1ad Merge branch 'main' into fix/1619-shutter-precision
# Conflicts:
#	crates/catalog/src/model.rs
#	crates/engine/src/files/tests.rs
#	docs/parity-checklist.md
2026-11-13 20:49:01 +01:00
FredApps 039fbdc645 Merge branch 'main' into fix/artcraft-feature-names-20261108 2026-11-13 20:43:08 +01:00
skylar taylor-barrick d23de47288 test(engine): isolate the initial availability notifications 2026-11-12 20:28:09 -06:00
skylar 5bc8dbe30c test(engine): wait for availability wake notifications 2026-11-12 20:06:31 -06:00
skylar 5fa4d0eba6 Merge current main into library folder safety work 2026-11-12 15:52:20 -06:00
Dylan M. Taylor a75497d634 security: importers and preset application index instead of rescanning
* security: importers and preset application index instead of rescanning

* address review: keep first match when indexing names, skip used mask ids, move presets instead of cloning

* address review: a dry-run import keeps its rows, not the parsed presets

* merge main into fix/sec-importers-indexed

* address review: key duplicate presets by the settings value, so 0.0 and -0.0 are one preset

* preset import index: key numbers as f64 so 0 and 0.0 cannot collide
2026-11-12 06:29:07 -05:00
Dylan M. Taylor 9563f22969 security(pipeline): one dab budget per brush mask; linear-time defringe min/max
* security(pipeline): one dab budget per brush mask; linear-time defringe min/max

* address review: drop min_filter transpose buffers once consumed

* address review: an over-budget brush mask fails the render instead of dropping later strokes

* merge main into fix/sec-pipeline-render-work; the web worker rejects an over-budget brush mask

* address review: validate brush budgets on the mask's own frame; an exactly filled budget is not over it
2026-11-12 06:28:59 -05:00
Dylan M. Taylor 0d88706ec5 security(meta): bound namespace declarations in scope while parsing XMP
* security(meta): bound namespace declarations in scope while parsing XMP

* address review: a readable sidecar that fails the merge read-back is kept and the save fails

* address review: a sidecar over the XMP complexity limit is kept and the save fails

* merge main into fix/sec-xmp-namespace-bound

* address review: text with no rdf:RDF element is backed up and replaced, not kept as readable

* xmp merge: open a self-closing rdf:RDF element instead of replacing the sidecar
2026-11-12 06:28:53 -05:00
Dylan M. Taylor 49c9d4e0ca security: bound token expansion, sanitize the name fallback, regular-file sidecar reads, recased sidecar guard
* engine: cap token expansion, clean the catalog-name fallback, bound sidecar and raw reads, protect recased sidecars, cap graphic pixels
2026-11-12 06:28:46 -05:00
Dylan M. Taylor e4dd081dd4 Use craft-gainmap from craft-libs for gain map metadata and arithmetic
Use craft-gainmap from craft-libs for gain map metadata and arithmetic

* Use craft-heif from craft-libs; remove crates/heif

lightcraft-heif moved to craft-libs unchanged as craft-heif
(storytold/craft-libs#784), so PhotoCraft can share it. The layer table,
the heif CI step and the change triggers drop the local crate; a workspace
file change (which a craft-heif rev bump is) still runs the heif step.

* Pin craft-heif to the merge of storytold/craft-libs#794

* docs: the HEIF rows point at craft-heif, not the removed crates/heif

* Use craft-gainmap from craft-libs for gain map metadata and arithmetic

crates/codecs/src/gainmap.rs keeps the JPEG layout (encode_jpeg, read_jpeg,
is_gain_map_jpeg) and re-exports GainMapMeta, GainImage, GainMapOptions,
ISO_URN, compute and apply from craft-gainmap, which is this file's metadata
and arithmetic moved to craft-libs (storytold/craft-libs#904). The tests of
the moved code went with it.

* craft-heif's Options has a chroma field at this rev: keep the libheif upsampling LightCraft had

* raw: count the chunks a TIFF declares from its offsets table

craft-tiff builds at most one chunk descriptor per byte of file
(craft-libs#827), so a grid of tiles sharing one payload lists fewer
chunks than the image declares. Compare the offsets table, which is the
source of truth, so such a file reaches the byte-accounting check and is
refused for the data it actually holds.
2026-11-12 00:43:54 -05:00
Dylan M. Taylor c24cf70d4b WIP: raw decoding through craft-raw (not compiled) 2026-11-12 01:05:37 +00:00
Dylan M. Taylor c5d60d2fa7 Use craft-tiff from craft-libs for TIFF/IFD (#4088)
* Use craft-tiff from craft-libs; remove crates/tiff

lightcraft-tiff moved to craft-libs unchanged as craft-tiff
(storytold/craft-libs#783), the first step of sharing RAW support with
PhotoCraft (storytold/craft-libs#587). The layer table drops tiff and its
intra-layer ordering before raster.

* Pin craft-tiff to the merge of storytold/craft-libs#795
2026-11-11 19:51:47 -05:00
Dylan M. Taylor aea4b80554 Merge main into the craft-heif + craft-tiff base 2026-11-12 00:37:58 +00:00
Dylan M. Taylor 55b14eaa31 Merge #4085 (craft-heif) into #4088 (craft-tiff) 2026-11-12 00:37:30 +00:00
Dylan M. Taylor 8ef35987d4 security: mask.exportEffects refuses originals and sidecars, writes atomically (#4125)
* mask.exportEffects refuses originals and sidecars and writes atomically

* check_write_target refuses unresolvable .. components in a missing destination folder

* test: accept either refusal for a missing/.. destination (Windows resolves .. lexically)
2026-11-11 15:14:21 -05:00
Dylan M. Taylor d6ae2e9e7e security(engine): read user-named files through the opened regular file under a byte cap (#3703)
* security(engine): read user-named files through the opened regular file under a byte cap

* address review: compare the probe error with the std::fs::read error

* address review: open files for reading without waiting for a FIFO writer
2026-11-11 14:34:39 -05:00
Dylan M. Taylor f786b87533 security(meta): linear entity decoding, indexed keyword de-duplication, bounded XMP path building (#3672)
* security(meta): linear entity decoding, indexed keyword de-duplication, bounded XMP path building

* address review: decode zero-padded numeric references in the three entity decoders
2026-11-11 04:26:21 -05:00
cezar 1a301fc2d8 LR-EDIT-LENSBLUR: camera-like Lens Blur with AI subject focus and per-mask bokeh
Part of the Lens Blur row (`LR-EDIT-LENSBLUR`, ⬜ → 🟡: no depth map yet). Related: #377 (SAM 3 subject selection, used here for the Lens Blur focus).

## Problem

Lens Blur settings existed but nothing rendered them: there was no way to add a shallow depth of field, keep the subject sharp while the rest falls out of focus, or blur only part of a photo through a mask.

## Change

**Edit → Lens Blur** (`section.lensBlur`, ⌘6)
- **Apply**, **Amount**, **Boost** (brighter bokeh highlights) and **Transition** (how gradually the blur grows away from what is in focus, so the subject doesn't look cut out).
- **In Focus**: *Subject* (a mask) or a fixed shape: **Auto / Round / Horizontal / Vertical**, buttons drawn in code that work on the light themes.
  - **Move & Resize** (tool `lensBlurShape`) drags the ellipse on the photo and stretches it by its handles. Each drag is one undo step; a shape button puts the ellipse back in the middle.
- **Find Subject** (`lensBlur.findSubject`) runs only when clicked, never automatically on Apply.
  - It starts from the focus point the camera recorded, when the file has one (Sony ILCE-1 and ILCE-7SM3, the models `lightcraft_meta` reads today). Otherwise it starts from the subject estimate.
  - SAM 3 keeps the prominent people and animals: those at the focus point and those of a similar size. When the focus point falls on neither, it falls back to an object click at that point.
  - The result is a normal Object mask ("Lens Blur Subject") that can be refined in Masking.
  - It runs on the background segment worker, and on remote SAM 3 too (`Operation::Subject`). While the mask is pending, the UI shows a spinner and the render keeps the subject estimate in focus, so the photo is never blurred whole.
  - Without the model, it returns the model-missing error, changes nothing, and the UI offers the SAM 3 download.
- **Brush Refinement**: Focus and Blur brushes painted on the photo (`lensBlur.brushStroke`, `lensBlur.brushReset`), with Size, Feather, Flow, Amount and Auto Mask.
- While Apply is off, In Focus, the shapes, Move & Resize and Find Subject are disabled.

**Masking: a Lens Blur block in every mask** (`section:maskLensBlur`, under Refine Edges)
- **Blur: Selection / Outside**. Outside blurs what the mask leaves out, without inverting the mask's other adjustments.
- **Amount**, **Boost** and **Transition**, per mask. The header's eye switches the block off and keeps its values; the header folds the block.
- Stored as `lens_blur`, `lens_blur_outside`, `lens_blur_boost`, `lens_blur_transition` and `lens_blur_off` on `LocalAdjustments`, set through `mask.adjust`.

**Rendering** (`crates/pipeline/src/lens_blur.rs`)
- Runs in the scene-linear stage after denoise; its settings are part of `pre_nr_key`.
- Disc (bokeh) kernel at four levels on coarse grids, with a normalized convolution weighted by the circle of confusion, so sharp areas don't bleed halos into the blur. Transition uses a chamfer distance to the in-focus area.
- The radius is relative to the long edge, so the blur doesn't depend on resolution. The work stays bounded on large exports: the disc kernel has a fixed size, and each level's coarse grid stays within a cell budget.
- Zoomed windows, both 8-bit and deep (16-bit/float), read around them and are cut back to the request. The grids follow the whole output's origin, and the automatic subject estimate is made once from the whole photo. A window therefore matches the whole render.
- GPU path: read back, apply on the CPU, upload (`crates/gpu/src/render.rs`).
- Hostile values (NaN or infinite sizes, out-of-range areas and focus points, oversized stroke lists) are sanitized or rejected, never a panic.

All new strings are in the 17 locales.

**Not in this PR:**
- Real depth. The falloff is the image distance from the focus, not scene depth; a depth model (e.g. Depth Anything V2 Small on candle) would be a separate PR.
- Rotating the ellipse.
- Aperture shapes.
- Focus points for more camera makes and models.
- Find Subject doesn't resume by itself after the SAM 3 download (the Masking tools do). Like the existing Object / Describe jobs, it shows no row in the activity stack.

## How it was checked

- [x] Full `cargo xtask ci` on Windows 11 x86_64 after the latest merge of `main` (465c8722):
  - fmt, clippy, heif, parity, layers, assets and wasm pass;
  - every Lens Blur test passes;
  - the only failures are five tests outside this change that fail on Windows on `main` too: `export::tests::sixteen_bit_zip_tiff_is_never_larger_than_uncompressed`, the two GPU out-of-memory tests in `gpu::ctx`, `dialog_role::settings_is_a_dialog_too` (needs craft-fonts) and `folder_drop::dont_ask_again_moves_the_next_drop_at_once`.
- [x] Tests that fail without the change:
  - **pipeline**:
    - the `lens_blur` tests: shapes and moved or hostile areas, blur growth away from the focus, the fallback while an AI mask is pending, brushes, masks blurring their selection or outside with Transition, hostile input;
    - `large_image_blur_work_is_bounded`: on a 60 MP export with the strongest global and per-mask settings, the disc kernel stays a fixed size and every level's coarse grid stays within its cell budget, including an offset render window;
    - window/full-render parity at U8 and U16, including the automatic subject.
  - **engine**: brushes with undo; Find Subject without the model changes nothing; deleting the focus mask clears the focus; a partial effect preset sets `lens_blur`; with the `sam` feature, Find Subject fills the waiting mask.
  - **segment**: `prominent_subjects`, and remote `Subject` validation.
  - **catalog**: `op_variants_are_versioned` with the new format version.
  - **ui-egui**: the brushes painting on the photo, the shape buttons, the controls disabled while Apply is off, Move & Resize with undo and redo, the mask block (side, sliders, eye, folding).
- [x] User-visible change: ran the app and looked at the result (dark and light themes).

## Screenshots

**Before / after**

<img width="1402" height="952" alt="before" src="https://github.com/user-attachments/assets/8baceb99-7708-4c25-990c-8da29b6bc1b4" />
<img width="1320" height="937" alt="after" src="https://github.com/user-attachments/assets/a1476510-558a-4460-8766-b25bda0dfd3d" />

**Edit → Lens Blur** and **the mask's Lens Blur block**

<img width="457" height="626" alt="main painel" src="https://github.com/user-attachments/assets/47a19637-29a8-4446-a003-2eef416975b7" />
<img width="463" height="333" alt="mask painel" src="https://github.com/user-attachments/assets/345ffc14-66d2-4adc-af3c-b756727201de" />

## Merging

- **Overlap:** #1713 (Clearfall; a draft since 2026-10-14 that conflicts with main) implements the same row on the CPU. It has aperture shapes and XMP roundtrip, which this PR lacks. This PR adds the per-mask block, SAM 3 Find Subject from the camera's focus point, the GPU path and window parity. Only one should land; happy to port what #1713 has that this lacks.
- **Existing edits and libraries:** unchanged. Lens Blur is off by default and every new field is omitted from the JSON at its default, so existing settings keep their JSON and hashes.
- **Shared numbers taken:** catalog format `VERSION` 12 (`crates/catalog/src/journal.rs`). main already uses 10 (`Mask.on_photo`) and 11 (`EmbeddedLens.source`), so Lens Blur takes one past them. If another pull request lands with 12 first, I'll take the next one when I merge main. No render-cache, look or process version change.
- **Where it came from:** own implementation; nothing derived from GPL code or Adobe data. The camera focus point comes from the existing `lightcraft_meta` reader; subject selection uses SAM 3 through the existing segment crate.
- **New dependencies, `unsafe`, build scripts, network access, spawned processes, deleted files, CI or `xtask` gate changes:** none. The remote SAM 3 protocol gains one request (`Operation::Subject`). An older worker rejects it with an error, as `docs/ai-masks.md` notes.

## Checklist

- [x] No new panic path in non-test code
- [x] New text on screen goes through `tr()` with keys in all `locales/*.json`; ⌘6 opens the new section (KEY-SECTIONS)
- [x] `docs/parity-checklist.md` rows updated (LR-EDIT-LENSBLUR 🟡, LR-MASK-SLIDERS, KEY-SECTIONS); `docs/gaps.md` has no Lens Blur entry
- [x] New code has a caller
- [x] No new assets (the shape icons are drawn in code)
- [x] Ready to merge

<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

* **New Features**
  * Added Lens Blur with adjustable strength, highlight boost, and transition controls, plus Round, Wide, and Tall focus shapes.
  * Keep a subject or selected mask in focus, find people or animals automatically, and refine focus or blur with brushes. Move and resize the focus area directly on the photo.
  * Apply Lens Blur to individual masks, including selections or areas outside them.
* **Bug Fixes**
  * Improved Lens Blur rendering for cropped views and preserved focus-mask assignments correctly when masks are edited.
* **Documentation**
  * Updated feature and control guides, with Lens Blur interface translations added across multiple languages.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-11-11 08:02:05 +01:00
Dylan M. Taylor ebfd2d063b Use craft-heif from craft-libs; remove crates/heif
lightcraft-heif moved to craft-libs unchanged as craft-heif
(storytold/craft-libs#784), so PhotoCraft can share it. The layer table,
the heif CI step and the change triggers drop the local crate; a workspace
file change (which a craft-heif rev bump is) still runs the heif step.
2026-11-11 01:25:39 +00:00
Dylan M. Taylor 34161c9a8c Use craft-tiff from craft-libs; remove crates/tiff
lightcraft-tiff moved to craft-libs unchanged as craft-tiff
(storytold/craft-libs#783), the first step of sharing RAW support with
PhotoCraft (storytold/craft-libs#587). The layer table drops tiff and its
intra-layer ordering before raster.
2026-11-11 01:25:32 +00:00
Dylan M. Taylor c2e9c456c9 security(segment): Object selections take at most 64 clicks at the engine API and the model (#3717)
* security(segment): Object selections take at most 64 clicks at the engine API and the model

* address review: refuse over-cap Object clicks before queueing in background mode
2026-11-10 18:07:21 -05:00