Skip to content
Closed
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
839fcfa
LR-LIB-PEOPLE: write face regions and names to XMP sidecars
edcasati Nov 18, 2026
23c3dac
LR-LIB-PEOPLE: fit face names and cleared regions to the sidecar on save
edcasati Nov 18, 2026
9f910a0
LR-LIB-PEOPLE: write boxes on turned files in the stored frame, as Li…
edcasati Nov 18, 2026
27b534b
LR-LIB-PEOPLE: keep a deliberate clear of file regions as an empty list
edcasati Nov 18, 2026
ebffce7
LR-LIB-PEOPLE: keep region entries LightCraft can't read when writing…
edcasati Nov 18, 2026
968e04e
LR-LIB-PEOPLE: describe clipping before skipping a box that can't be …
edcasati Nov 18, 2026
c35f0ef
LR-LIB-PEOPLE: state the detector-box overlap as intersection over union
edcasati Nov 18, 2026
75fa2ed
LR-LIB-PEOPLE: keep the file's orientation in the catalog; saves neve…
edcasati Nov 18, 2026
bd2aabc
LR-LIB-PEOPLE: write boxes on turned, mirrored photos (Exif 5, 7) in …
edcasati Nov 18, 2026
582022b
LR-LIB-PEOPLE: one orientation for a photo's size and its file_orient…
edcasati Nov 18, 2026
a36657c
LR-LIB-PEOPLE: write 5/7 boxes upright when the list keeps no size
edcasati Nov 18, 2026
b809f0b
LR-LIB-PEOPLE: an unreadable sidecar fails Read Metadata even when th…
edcasati Nov 18, 2026
9a9b4c1
LR-LIB-PEOPLE: bound the orientation backfill and probe only for it
edcasati Nov 18, 2026
50d8ee1
LR-LIB-PEOPLE: a JPEG XMP read that fails is unreadable, not a missin…
edcasati Nov 18, 2026
9931b52
LR-LIB-PEOPLE: read a preview-only raw's boxes by its stated orientation
edcasati Nov 19, 2026
9773de7
LR-LIB-PEOPLE: Synchronize Folder reads face boxes by the import's or…
edcasati Nov 19, 2026
35be41e
LR-LIB-PEOPLE: read a non-raw's orientation from its header, not the …
edcasati Nov 19, 2026
3065c01
LR-LIB-PEOPLE: write boxes upright when a kept entry has a rotation
edcasati Nov 19, 2026
e000ed1
LR-LIB-PEOPLE: no orientation for a PSD whose fixed header is invalid
edcasati Nov 19, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion crates/catalog/src/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,8 @@ pub struct Meta {
pub creator: String,
pub keywords: Vec<String>,
/// Face/pet/focus regions read from XMP (MWG-RS), on the upright (EXIF-oriented) photo.
/// Removing or resizing one edits the catalog only; LightCraft never writes regions to XMP.
/// Written to the photo's sidecar when one is saved (`lightcraft_engine::sidecar`), the detector's unnamed boxes
/// excepted.
/// Left out of the catalog JSON when empty (most photos), so older catalogs read unchanged.
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub regions: Vec<lightcraft_meta::Region>,
Expand Down
2 changes: 2 additions & 0 deletions crates/engine/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ lightcraft-raw = { workspace = true }
lightcraft-denoise-core = { workspace = true }
lightcraft-denoise = { workspace = true, optional = true }
lightcraft-meta = { workspace = true }
# finds the text of the region entries in a sidecar that LightCraft can't read, to keep them on save (sidecar.rs)
roxmltree = "0.21"
lightcraft-lensdb = { workspace = true }
lightcraft-faces = { workspace = true }
miniz_oxide = { workspace = true }
Expand Down
4 changes: 2 additions & 2 deletions crates/engine/src/cmd/face_detect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
//! made do not matter), the detector runs on it, and the faces come back as fractions of the photo's width
//! and height, the same frame face regions from XMP use. Unless `apply` is false, they are added to the photo as
//! unnamed face regions in one undoable step; earlier detections are replaced, and regions that came from XMP (or
//! that you drew or named) are never touched. Like every region edit it is catalog-only: no sidecar is written.
//! that you drew or named) are never touched. Unnamed detected boxes are LightCraft's bookkeeping and are never written to a sidecar.

use std::path::PathBuf;
use std::sync::{Arc, Mutex, PoisonError};
Expand Down Expand Up @@ -291,7 +291,7 @@ fn detect(s: &mut Session, p: &Value) -> Result<Value> {
let applied = !ops.is_empty();
if applied {
s.commit("Detect Faces", Op::Batch { ops })?;
// regions are not written to XMP, so a sidecar must not be rewritten for this
// unnamed detected boxes are not written to XMP, so a sidecar must not be rewritten for this
s.skip_auto_write = true;
}
Ok(json!({"detector": LABEL, "applied": applied, "photos": results, "ms": started.elapsed().as_secs_f64() * 1000.0}))
Expand Down
16 changes: 7 additions & 9 deletions crates/engine/src/cmd/face_recognize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
//! what teaches the suggestions). `faces.renamePerson` renames every in-library face of one person, or merges two
//! people when asked.
//!
//! Everything here is a suggestion for the user to confirm; nothing is ever named automatically. All of it is
//! catalog-only (no sidecar is written) and naming is undoable.
//! Everything here is a suggestion for the user to confirm; nothing is ever named automatically. Suggestions stay
//! in the library; a confirmed name reaches the photo's sidecar whenever it is written (`crate::sidecar`), and naming
//! is undoable.

use lightcraft_catalog::Op;
use serde_json::{Value, json};
Expand Down Expand Up @@ -74,7 +75,6 @@ fn name_faces(s: &mut Session, p: &Value) -> Result<Value> {
}
let photos = ops.len();
s.commit(if name.is_some() { "Name Faces" } else { "Clear Face Names" }, Op::Batch { ops })?;
s.skip_auto_write = true;
Ok(json!({"named": named, "photos": photos, "name": name}))
}

Expand All @@ -89,7 +89,6 @@ fn set_name(s: &mut Session, p: &Value) -> Result<Value> {
let region = meta.regions.get_mut(index).ok_or_else(|| bad(C, "no such region"))?;
apply_name(region, &name);
s.commit(if name.is_some() { "Name Face" } else { "Clear Face Name" }, Op::SetMeta { id, meta: Box::new(meta) })?;
s.skip_auto_write = true;
Ok(json!({"id": id.0, "index": index, "name": name}))
}

Expand Down Expand Up @@ -172,7 +171,6 @@ fn rename_person(s: &mut Session, p: &Value) -> Result<Value> {
}
let photos = ops.len();
s.commit(if other { "Merge People" } else { "Rename Person" }, Op::Batch { ops })?;
s.skip_auto_write = true;
if s.filter.person.as_deref().is_some_and(|n| n.trim().to_lowercase() == from_key) {
s.filter.person = Some(to.clone());
}
Expand Down Expand Up @@ -391,7 +389,7 @@ mod imp {
meta.regions.push(Region { rect: *rect, kind: RegionKind::Face, name: None, description: Some(format!("{MARK}{LABEL}")) });
}
if s.apply_system(Op::SetMeta { id, meta: Box::new(meta) }).is_ok() {
// regions are not written to XMP, so no sidecar may be rewritten for this
// unnamed detected boxes are not written to XMP, so no sidecar may be rewritten for this
s.skip_auto_write = true;
}
}
Expand Down Expand Up @@ -1181,7 +1179,7 @@ pub fn specs() -> Vec<CommandSpec> {
"Name Faces",
[],
None,
"{faces: [{photo, index}], name} → {named, photos} — name (or, with a null or empty name, clear) many face regions as one undoable step; the sidecar is not touched",
"{faces: [{photo, index}], name} → {named, photos} — name (or, with a null or empty name, clear) many face regions as one undoable step; with auto-write on, the sidecar of each changed original is rewritten (its `mwg-rs:Regions` and `Iptc4xmpExt:PersonInImage`)",
super::always,
name_faces
),
Expand All @@ -1199,7 +1197,7 @@ pub fn specs() -> Vec<CommandSpec> {
"Name Face",
[],
None,
"{id?, index, name} — name a face region (null or empty clears it); undoable; the sidecar is not touched",
"{id?, index, name} — name a face region (null or empty clears it); undoable; with auto-write on, the sidecar of each changed original is rewritten (its `mwg-rs:Regions` and `Iptc4xmpExt:PersonInImage`)",
super::always,
set_name
),
Expand All @@ -1208,7 +1206,7 @@ pub fn specs() -> Vec<CommandSpec> {
"Rename Person",
[],
None,
"{from, to, merge?: bool} → {faces, photos, from, to, merged} — give every in-library face of `from` the name `to` (trimmed, any capitalization), one undo step; refused when `to` is already someone else unless `merge` is true, which combines the two; the sidecar is not touched",
"{from, to, merge?: bool} → {faces, photos, from, to, merged} — give every in-library face of `from` the name `to` (trimmed, any capitalization), one undo step; refused when `to` is already someone else unless `merge` is true, which combines the two; with auto-write on, the sidecar of each changed original is rewritten (its `mwg-rs:Regions` and `Iptc4xmpExt:PersonInImage`)",
super::always,
rename_person
),
Expand Down
6 changes: 2 additions & 4 deletions crates/engine/src/cmd/library/specs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,7 @@ pub fn specs() -> Vec<CommandSpec> {
"Remove Face Box",
[],
None,
"{id?, index} — remove one face / pet region (by its position in the photo's regions) from the photo in the catalog; undoable. The XMP sidecar is never rewritten for this, even with auto-write on, so reading the metadata from the file brings the region back",
"{id?, index} — remove one face / pet region (by its position in the photo's regions) from the photo; undoable. With auto-write on, the sidecar of each changed original is rewritten (its `mwg-rs:Regions` and `Iptc4xmpExt:PersonInImage`)",
always,
|s, p| {
let id =
Expand All @@ -615,7 +615,6 @@ pub fn specs() -> Vec<CommandSpec> {
}
let gone = meta.regions.remove(index);
s.commit("Remove Face Box", Op::SetMeta { id, meta: Box::new(meta) })?;
s.skip_auto_write = true;
Ok(json!({"removed": gone.name}))
}
),
Expand All @@ -624,7 +623,7 @@ pub fn specs() -> Vec<CommandSpec> {
"Resize Face Box",
[],
None,
"{id?, index, rect: {x0, y0, x1, y1}} — set one face / pet region's box (normalized, in the photo's upright frame; clamped to the photo, at least 0.5 % each way) in the catalog; undoable. Like photo.removeRegion it never rewrites the XMP sidecar",
"{id?, index, rect: {x0, y0, x1, y1}} — set one face / pet region's box (normalized, in the photo's upright frame; clamped to the photo, at least 0.5 % each way) ; undoable. With auto-write on, the sidecar of each changed original is rewritten (its `mwg-rs:Regions` and `Iptc4xmpExt:PersonInImage`)",
Comment thread
edcasati marked this conversation as resolved.
Resolved
always,
|s, p| {
const C: &str = "photo.setRegion";
Expand All @@ -649,7 +648,6 @@ pub fn specs() -> Vec<CommandSpec> {
let region = meta.regions.get_mut(index).ok_or_else(|| bad(C, "no such region"))?;
region.rect = lightcraft_geom::Rect { x0, y0, x1, y1 };
s.commit("Resize Face Box", Op::SetMeta { id, meta: Box::new(meta) })?;
s.skip_auto_write = true;
Ok(json!({"rect": {"x0": x0, "y0": y0, "x1": x1, "y1": y1}}))
}
),
Expand Down
Loading