Skip to content

LightCraft: An open-source non-destructive photo editor written by scratch in pure Rust

People view: a card per named person with a cropped face, replacing the sidebar list

Daniel Voshart8859f797d8f4
diff --git a/crates/catalog/src/lib.rs b/crates/catalog/src/lib.rs
index aad5949bc..097a71790 100644
--- a/crates/catalog/src/lib.rs
+++ b/crates/catalog/src/lib.rs
@@ -35,7 +35,7 @@ use lightcraft_develop::DevelopSettings;
pub use local::{DEFAULT_FORGET_DAYS, ForgetPlan, folder_of};
pub use lock::{LibraryLock, LockError, LockOwner};
pub use model::*;
-pub use query::{DateGroup, Filter, RatingOp, Sort, SortKey};
+pub use query::{DateGroup, Filter, Person, RatingOp, Sort, SortKey};
pub use rules::{Match, Rule, RuleSet};
use serde::{Deserialize, Serialize};
pub use store::{FsStore, MemStore, Store};
diff --git a/crates/catalog/src/query.rs b/crates/catalog/src/query.rs
index b7165bb15..e25e889a1 100644
--- a/crates/catalog/src/query.rs
+++ b/crates/catalog/src/query.rs
@@ -350,29 +350,47 @@ impl Catalog {
m.into_iter().collect()
}
- /// The people named on faces in the library (MWG regions read from XMP) with the number of
- /// photos each appears in, most photos first, then by name. Names that differ only in case are
- /// one person, shown as first seen. A person twice in one photo counts once.
- pub fn people(&self) -> Vec<(String, usize)> {
- let mut m: std::collections::HashMap<String, (String, usize)> = Default::default();
+ /// The people named on faces in the library (MWG regions read from XMP): how many photos each
+ /// appears in and the photo showing their largest face (for a card's picture). Most photos first,
+ /// then by name. Names that differ only in case are one person, shown as first seen; a person
+ /// twice in one photo counts once.
+ pub fn people(&self) -> Vec<Person> {
+ let mut m: std::collections::HashMap<String, (Person, f64)> = Default::default();
for p in self.photos().filter(|p| p.in_library()) {
let mut seen: Vec<String> = Vec::new();
for r in p.meta.regions.iter().filter(|r| r.kind == lightcraft_meta::RegionKind::Face) {
let Some(name) = r.name.as_deref().map(str::trim).filter(|n| !n.is_empty()) else { continue };
let key = name.to_lowercase();
- if seen.contains(&key) {
- continue;
+ // the face's size in pixels of the photo
+ let area = (r.rect.x1 - r.rect.x0) * (r.rect.y1 - r.rect.y0) * p.width as f64 * p.height as f64;
+ let (person, best) =
+ m.entry(key.clone()).or_insert_with(|| (Person { name: name.to_string(), count: 0, photo: p.id, face: r.rect }, area));
+ if !seen.contains(&key) {
+ person.count += 1;
+ seen.push(key);
+ }
+ if area > *best || (area == *best && p.id < person.photo) {
+ (person.photo, person.face, *best) = (p.id, r.rect, area);
}
- m.entry(key.clone()).or_insert_with(|| (name.to_string(), 0)).1 += 1;
- seen.push(key);
}
}
- let mut v: Vec<(String, usize)> = m.into_values().collect();
- v.sort_by(|a, b| b.1.cmp(&a.1).then_with(|| a.0.to_lowercase().cmp(&b.0.to_lowercase())));
+ let mut v: Vec<Person> = m.into_values().map(|(p, _)| p).collect();
+ v.sort_by(|a, b| b.count.cmp(&a.count).then_with(|| a.name.to_lowercase().cmp(&b.name.to_lowercase())));
v
}
}
+/// A person named on faces in the library ([`Catalog::people`]).
+#[derive(Clone, Debug, PartialEq)]
+pub struct Person {
+ pub name: String,
+ /// Photos they appear in.
+ pub count: usize,
+ /// The photo with their largest face, and that face (normalized, in the photo's upright frame).
+ pub photo: PhotoId,
+ pub face: lightcraft_meta::Rect,
+}
+
#[derive(Clone, Debug, PartialEq, Serialize)]
pub struct DateGroup {
pub year: String,
diff --git a/crates/catalog/src/tests.rs b/crates/catalog/src/tests.rs
index 9add629ef..3c257da1a 100644
--- a/crates/catalog/src/tests.rs
+++ b/crates/catalog/src/tests.rs
@@ -323,14 +323,16 @@ fn people_from_named_face_regions() {
);
let b =
add("b.jpg", vec![region(Some("JANE DOE"), RegionKind::Face), region(Some("John Roe"), RegionKind::Face), region(None, RegionKind::Face)]);
- let d = add("d.jpg", vec![region(Some("John Roe"), RegionKind::Face)]);
+ let big = Rect { x0: 0.2, y0: 0.2, x1: 0.8, y1: 0.8 };
+ let d = add("d.jpg", vec![Region { rect: big, ..region(Some("John Roe"), RegionKind::Face) }]);
let e = add("e.jpg", vec![region(Some("Sam"), RegionKind::Face)]);
add("f.jpg", vec![]);
- assert_eq!(
- c.people(),
- vec![("Jane Doe".to_string(), 2), ("John Roe".to_string(), 2), ("Sam".to_string(), 1)],
- "once per photo, pets and unnamed faces left out"
- );
+ let people = c.people();
+ let summary: Vec<(&str, usize)> = people.iter().map(|p| (p.name.as_str(), p.count)).collect();
+ assert_eq!(summary, vec![("Jane Doe", 2), ("John Roe", 2), ("Sam", 1)], "once per photo, pets and unnamed faces left out");
+ // the picture is the person's largest face; ties go to the lower photo id
+ assert_eq!((people[0].photo, people[0].face), (a, Rect { x0: 0.4, y0: 0.4, x1: 0.6, y1: 0.6 }));
+ assert_eq!((people[1].photo, people[1].face), (d, big), "the larger face wins over an earlier, smaller one");
let q = |f: Filter| c.query(&f, &Sort::default());
assert_eq!(q(Filter { person: Some("jane doe".into()), ..Default::default() }).len(), 2);
diff --git a/crates/engine/src/media.rs b/crates/engine/src/media.rs
index c61470d0f..6a5e3d3dc 100644
--- a/crates/engine/src/media.rs
+++ b/crates/engine/src/media.rs
@@ -705,6 +705,43 @@ impl crate::Session {
})
}
+ /// A square close-up of `face` (normalized, in the photo's upright frame) for a People card: the
+ /// photo's own look with its crop replaced by a square around the face (room for hair and chin),
+ /// `edge` pixels across (≤ 512). The source level is the smallest that keeps the face sharp, up
+ /// to the preview. Cached like [`Self::variant_job`], and `key` likewise follows the content.
+ pub fn face_job(&mut self, id: PhotoId, face: lightcraft_geom::Rect, edge: usize) -> Option<RenderJob> {
+ let p = self.catalog.photo(id)?.clone();
+ let (w, h) = (f64::from(p.width.max(1)), f64::from(p.height.max(1)));
+ let side = ((face.x1 - face.x0) * w).max((face.y1 - face.y0) * h) * 1.7;
+ // finite, within the photo, and never wider than its short side (so the clamps below are valid)
+ let side = if side.is_finite() { side.clamp(1.0, w.min(h)) } else { w.min(h) };
+ let (cx, cy) = ((face.x0 + face.x1) / 2.0 * w, (face.y0 + face.y1) / 2.0 * h);
+ let (cx, cy) = (if cx.is_finite() { cx } else { w / 2.0 }, if cy.is_finite() { cy } else { h / 2.0 });
+ let (x0, y0) = (cx.clamp(side / 2.0, w - side / 2.0) - side / 2.0, cy.clamp(side / 2.0, h - side / 2.0) - side / 2.0);
+ let rect = lightcraft_geom::Rect { x0: x0 / w, y0: y0 / h, x1: (x0 + side) / w, y1: (y0 + side) / h };
+ let mut settings = (*p.develop).clone();
+ settings.crop = lightcraft_develop::Crop { geometry: lightcraft_geom::CropGeometry { rect, angle: 0.0 }, ..Default::default() };
+ let edge = edge.clamp(16, SourceLevel::Thumb.max_edge());
+ // pixels along the long edge that leave `edge` across the crop
+ let needed = (edge as f64 * w.max(h) / side).ceil().min(SourceLevel::Preview.max_edge() as f64);
+ let level = SourceLevel::for_size(needed as usize);
+ let source = self.media.source_ref(&p, level);
+ let ck = Self::variant_key(&p, &settings, edge);
+ Some(RenderJob {
+ photo: id,
+ level,
+ source,
+ origin: p.source.clone(),
+ info: source_info(&p),
+ settings: Arc::new(settings),
+ request: RenderRequest { apply_crop: true, ..RenderRequest::fit(edge, edge) },
+ key: (ck.0 as u64) ^ ((ck.0 >> 64) as u64),
+ cache: Some((self.media.rendered.clone(), ck)),
+ stages: None,
+ view_cache: None,
+ })
+ }
+
/// Size-independent cache key of a photo's view render (loupe) for its current settings.
fn view_key(p: &Photo, apply_crop: bool) -> Hash128 {
Hasher128::new().str(&content_key(p)).str("view").u64(p.develop.hash64()).u64(apply_crop as u64).u64(RENDER_CACHE_VERSION).finish()
diff --git a/crates/engine/src/tests.rs b/crates/engine/src/tests.rs
index 58b7e643e..9becd6c62 100644
--- a/crates/engine/src/tests.rs
+++ b/crates/engine/src/tests.rs
@@ -727,3 +727,37 @@ fn curve_reset_by_channel_and_whole() {
assert_eq!(active_dev(&s).curve, lightcraft_develop::ToneCurve::default());
assert!(s.execute("curve.reset", &json!({"channel": "alpha"})).is_err());
}
+
+/// A People card's close-up is a square (in pixels) inside the photo, around the face, whatever the
+/// face rectangle says: corners, oversized and degenerate rectangles never leave the frame or panic.
+#[test]
+fn face_job_crops_a_square_inside_the_photo() {
+ use lightcraft_geom::Rect;
+ let mut s = demo();
+ let id = s.active().unwrap();
+ let (w, h) = {
+ let p = s.catalog.photo(id).unwrap();
+ (f64::from(p.width), f64::from(p.height))
+ };
+ let faces = [
+ Rect { x0: 0.40, y0: 0.30, x1: 0.50, y1: 0.45 },
+ Rect { x0: 0.0, y0: 0.0, x1: 0.05, y1: 0.05 },
+ Rect { x0: 0.95, y0: 0.95, x1: 1.0, y1: 1.0 },
+ Rect { x0: -5.0, y0: -5.0, x1: 5.0, y1: 5.0 },
+ Rect { x0: 0.5, y0: 0.5, x1: 0.5, y1: 0.5 },
+ Rect { x0: f64::NAN, y0: 0.5, x1: 0.6, y1: f64::INFINITY },
+ ];
+ for face in faces {
+ let job = s.face_job(id, face, 256).expect("a job for a photo in the library");
+ let r = job.settings.crop.geometry.rect;
+ assert!((0.0..=1.0).contains(&r.x0) && (0.0..=1.0).contains(&r.y0) && r.x1 <= 1.0 + 1e-9 && r.y1 <= 1.0 + 1e-9, "{face:?} → {r:?}");
+ assert!(r.x1 > r.x0 && r.y1 > r.y0, "{face:?} → {r:?}");
+ let (pw, ph) = ((r.x1 - r.x0) * w, (r.y1 - r.y0) * h);
+ assert!((pw - ph).abs() < 1e-6 * w.max(h), "square in pixels: {face:?} → {pw} × {ph}");
+ assert_eq!(job.settings.crop.geometry.angle, 0.0);
+ }
+ // a face around (0.45, 0.375) is centred in its crop (room to spare on every side)
+ let r = s.face_job(id, faces[0], 256).unwrap().settings.crop.geometry.rect;
+ assert!((((r.x0 + r.x1) / 2.0) - 0.45).abs() < 1e-9 && (((r.y0 + r.y1) / 2.0) - 0.375).abs() < 1e-9, "{r:?}");
+ assert!(s.face_job(lightcraft_catalog::PhotoId(u64::MAX), faces[0], 256).is_none());
+}
diff --git a/crates/ui-egui/src/lib.rs b/crates/ui-egui/src/lib.rs
index 449bf4df6..d0c33e6a2 100644
--- a/crates/ui-egui/src/lib.rs
+++ b/crates/ui-egui/src/lib.rs
@@ -713,6 +713,7 @@ impl LightcraftApp {
state::ViewMode::Compare => panels::compare::show_compare(self, ui),
state::ViewMode::Survey => panels::compare::show_survey(self, ui),
state::ViewMode::Reference => panels::compare::show_reference(self, ui),
+ state::ViewMode::People => panels::people::show(self, ui),
});
panels::second::show(self, &ctx);
panels::notices::show(self, &ctx);
@@ -789,7 +790,7 @@ mod drop_tests {
#[derive(Default)]
pub struct Caches {
keyword_tree: Option<(u64, std::sync::Arc<Vec<lightcraft_catalog::KeywordNode>>)>,
- people: Option<(u64, std::sync::Arc<Vec<(String, usize)>>)>,
+ people: Option<(u64, std::sync::Arc<Vec<lightcraft_catalog::Person>>)>,
suggestions: Option<(u64, std::sync::Arc<Vec<String>>)>,
counts: Option<(u64, LibraryCounts)>,
date_groups: Option<(u64, std::sync::Arc<Vec<lightcraft_catalog::DateGroup>>)>,
@@ -837,7 +838,7 @@ impl Caches {
}
}
/// The people named on faces, with photo counts.
- pub fn people(&mut self, cat: &lightcraft_catalog::Catalog) -> std::sync::Arc<Vec<(String, usize)>> {
+ pub fn people(&mut self, cat: &lightcraft_catalog::Catalog) -> std::sync::Arc<Vec<lightcraft_catalog::Person>> {
match &self.people {
Some((r, t)) if *r == cat.revision => t.clone(),
_ => {
diff --git a/crates/ui-egui/src/menubar.rs b/crates/ui-egui/src/menubar.rs
index f122041e0..fce32157a 100644
--- a/crates/ui-egui/src/menubar.rs
+++ b/crates/ui-egui/src/menubar.rs
@@ -119,6 +119,7 @@ const LAYOUT: &[(&str, &[&str])] = &[
"view.detail",
"view.compare",
"view.survey",
+ "view.people",
"---",
"view.leftPanel",
"view.photoCounts",
@@ -280,6 +281,7 @@ pub fn checked(app: &LightcraftApp, id: &str) -> Option<bool> {
"view.detail" => Some(u.view == ViewMode::Detail),
"view.compare" => Some(u.view == ViewMode::Compare),
"view.survey" => Some(u.view == ViewMode::Survey),
+ "view.people" => Some(u.view == ViewMode::People),
"view.reference" => Some(u.view == ViewMode::Reference),
"view.leftPanel" => Some(u.left_panel),
"view.filmstrip" => Some(u.filmstrip),
diff --git a/crates/ui-egui/src/menus.rs b/crates/ui-egui/src/menus.rs
index 5d838b759..a4a8ced9d 100644
--- a/crates/ui-egui/src/menus.rs
+++ b/crates/ui-egui/src/menus.rs
@@ -21,6 +21,7 @@ pub const UI_COMMANDS: &[UiCommand] = &[
("view.detail", "Detail", Some("D"), "View"),
("view.compare", "Compare", Some("Shift+C"), "View"),
("view.survey", "Survey", Some("N"), "View"),
+ ("view.people", "People", None, "View"),
("view.reference", "Reference View", Some("Shift+R"), "View"),
("photo.setReference", "Set as Reference Photo", None, ""),
("compare.swap", "Swap Compare Photos", None, "View"),
@@ -263,6 +264,10 @@ pub fn run_ui_command(app: &mut LightcraftApp, id: &str, p: &Value) -> Option<Re
Ok(Value::Null)
}
"view.compare" => crate::panels::compare::enter_compare(app),
+ "view.people" => {
+ app.ui.view = ViewMode::People;
+ Ok(json!({"people": app.session.catalog.people().len()}))
+ }
"view.survey" => {
app.ui.view = ViewMode::Survey;
Ok(json!({"photos": crate::panels::compare::survey_photos(app).len()}))
diff --git a/crates/ui-egui/src/panels/bottombar.rs b/crates/ui-egui/src/panels/bottombar.rs
index 4e0f91763..049a8fbd6 100644
--- a/crates/ui-egui/src/panels/bottombar.rs
+++ b/crates/ui-egui/src/panels/bottombar.rs
@@ -26,6 +26,7 @@ pub fn show(app: &mut LightcraftApp, ui: &mut egui::Ui) {
("detail", Icon::Single, ViewMode::Detail, "Detail (D)"),
("compare", Icon::Compare, ViewMode::Compare, "Compare (Shift+C)"),
("survey", Icon::Survey, ViewMode::Survey, "Survey (N)"),
+ ("people", Icon::Subject, ViewMode::People, "People"),
] {
if icon_button(ui, id, icon, vec2(32.0, 32.0), app.ui.view == mode, true, tip).clicked() {
let _ = app.run(&format!("view.{id}"), json!({}));
diff --git a/crates/ui-egui/src/panels/left.rs b/crates/ui-egui/src/panels/left.rs
index 12477757b..7d7037435 100644
--- a/crates/ui-egui/src/panels/left.rs
+++ b/crates/ui-egui/src/panels/left.rs
@@ -134,7 +134,6 @@ pub fn show(app: &mut LightcraftApp, ui: &mut egui::Ui) {
}
}
}
- people_section(app, ui);
keywords_section(app, ui);
ui.add_space(10.0);
if row(app, ui, "recentlyDeleted", Icon::Trash, "Recently Deleted", Some(deleted), src == LibrarySource::RecentlyDeleted, 0.0).clicked() {
@@ -665,30 +664,6 @@ fn is_within(app: &LightcraftApp, id: lightcraft_catalog::AlbumId, ancestor: lig
false
}
-/// "People": the names on faces read from XMP (MWG regions), with photo counts. A click filters the
-/// grid to that person; a second click clears it. (Names only for now: no face detection or
-/// identity yet, and LightCraft does not write regions.)
-fn people_section(app: &mut LightcraftApp, ui: &mut egui::Ui) {
- let t = Tokens::get(ui.ctx());
- let people = app.caches.people(&app.session.catalog);
- if people.is_empty() {
- return;
- }
- ui.add_space(10.0);
- let (hr, _) = ui.allocate_exact_size(vec2(ui.available_width(), 34.0), Sense::hover());
- ui.painter().text(pos2(hr.left() + 18.0, hr.center().y), Align2::LEFT_CENTER, "People", t.semibold(13.5), t.text_label);
- for (name, count) in people.iter() {
- let sel = app.session.filter.person.as_deref().is_some_and(|k| k.eq_ignore_ascii_case(name));
- // a long name must not run into the count
- let shown = if name.chars().count() > 22 { format!("{}…", name.chars().take(21).collect::<String>()) } else { name.clone() };
- let resp = row(app, ui, &format!("person:{name}"), Icon::Subject, &shown, Some(*count), sel, 0.0).on_hover_text(name);
- if resp.clicked() {
- let v = if sel { serde_json::Value::Null } else { json!(name) };
- let _ = app.run("library.filter", json!({"person": v}));
- }
- }
-}
-
/// "Keywords": the library's keyword tree with photo counts (`a|b|c` keywords nest). A click
/// filters the grid by the keyword (children included), the triangle opens a level, and the
/// context menu renames, merges or deletes the keyword across the library.
diff --git a/crates/ui-egui/src/panels/mod.rs b/crates/ui-egui/src/panels/mod.rs
index cfb40d68a..8317dda78 100644
--- a/crates/ui-egui/src/panels/mod.rs
+++ b/crates/ui-egui/src/panels/mod.rs
@@ -13,6 +13,7 @@ pub mod left;
pub mod library_problem;
pub mod masking;
pub mod notices;
+pub mod people;
pub mod presets;
pub mod profiles;
pub mod right;
diff --git a/crates/ui-egui/src/panels/people.rs b/crates/ui-egui/src/panels/people.rs
new file mode 100644
index 000000000..52108c53e
--- /dev/null
+++ b/crates/ui-egui/src/panels/people.rs
@@ -0,0 +1,87 @@
+//! People: a card per person named on faces (read from XMP): a close-up of their largest face, the
+//! name and how many photos they are in. A click shows that person's photos in the grid.
+//!
+//! Only the rows on screen ask for a face render (the engine caches them, memory and disk).
+
+use egui::{Align2, Color32, Rect, Sense, Stroke, StrokeKind, pos2, vec2};
+use lightcraft_catalog::Person;
+use serde_json::json;
+
+use crate::LightcraftApp;
+use crate::theme::Tokens;
+use crate::widgets::register;
+
+/// A card's face picture (points); the name and count sit below it.
+const CARD: f32 = 150.0;
+const LABEL_H: f32 = 44.0;
+const GAP: f32 = 16.0;
+const PAD: f32 = 20.0;
+const HEADER_H: f32 = 44.0;
+
+pub fn show(app: &mut LightcraftApp, ui: &mut egui::Ui) {
+ let t = Tokens::get(ui.ctx());
+ let people = app.caches.people(&app.session.catalog);
+ let (head, _) = ui.allocate_exact_size(vec2(ui.available_width(), HEADER_H), Sense::hover());
+ ui.painter().text(pos2(head.left() + PAD, head.center().y), Align2::LEFT_CENTER, "Named People", t.semibold(15.0), t.text);
+ ui.painter().text(pos2(head.right() - PAD, head.center().y), Align2::RIGHT_CENTER, people.len().to_string(), t.font(13.0), t.text_dim);
+ if people.is_empty() {
+ let c = ui.available_rect_before_wrap().center();
+ ui.painter().text(c, Align2::CENTER_CENTER, "No named people yet", t.semibold(15.0), t.text_label);
+ ui.painter().text(
+ c + vec2(0.0, 26.0),
+ Align2::CENTER_CENTER,
+ "Face names written to XMP by Lightroom and other apps show up here.",
+ t.font(13.0),
+ t.text_dim,
+ );
+ return;
+ }
+ let ppp = ui.ctx().pixels_per_point();
+ let active = app.session.filter.person.clone();
+ egui::ScrollArea::vertical().auto_shrink(false).show_viewport(ui, |ui, viewport| {
+ let width = ui.available_width();
+ let cols = (((width - PAD * 2.0 + GAP) / (CARD + GAP)).floor() as usize).max(1);
+ let row_h = CARD + LABEL_H + GAP;
+ let rows = people.len().div_ceil(cols);
+ let (area, _) = ui.allocate_exact_size(vec2(width, PAD * 2.0 + rows as f32 * row_h), Sense::hover());
+ let first = ((viewport.top() - PAD) / row_h).floor().max(0.0) as usize;
+ let last = (((viewport.bottom() - PAD) / row_h).ceil().max(0.0) as usize).min(rows);
+ for row in first..last {
+ for col in 0..cols {
+ let Some(person) = people.get(row * cols + col) else { break };
+ let min = area.min + vec2(PAD + col as f32 * (CARD + GAP), PAD + row as f32 * row_h);
+ let selected = active.as_deref().is_some_and(|a| a.eq_ignore_ascii_case(&person.name));
+ card(app, ui, person, Rect::from_min_size(min, vec2(CARD, CARD + LABEL_H)), ppp, selected);
+ }
+ }
+ });
+}
+
+fn card(app: &mut LightcraftApp, ui: &mut egui::Ui, person: &Person, r: Rect, ppp: f32, selected: bool) {
+ let t = Tokens::get(ui.ctx());
+ let face = Rect::from_min_size(r.min, vec2(CARD, CARD));
+ let resp = ui.interact(r, egui::Id::new(("person-card", &person.name)), Sense::click());
+ register(ui.ctx(), format!("person:{}", person.name), r);
+ let p = ui.painter();
+ p.rect_filled(face, 3.0, t.canvas);
+ if let Some(job) = app.session.face_job(person.photo, person.face, (CARD * ppp).ceil() as usize)
+ && let Some(tex) = app.renderer.variant(job)
+ {
+ p.image(tex.tex.id(), face, Rect::from_min_max(pos2(0.0, 0.0), pos2(1.0, 1.0)), Color32::WHITE);
+ }
+ if selected {
+ p.rect_stroke(face, 3.0, Stroke::new(2.0, Color32::WHITE), StrokeKind::Outside);
+ } else if resp.hovered() {
+ p.rect_stroke(face, 3.0, Stroke::new(1.0, t.text_dim), StrokeKind::Outside);
+ }
+ // a long name must not run past the card
+ let name =
+ if person.name.chars().count() > 19 { format!("{}…", person.name.chars().take(18).collect::<String>()) } else { person.name.clone() };
+ p.text(pos2(r.left() + 2.0, face.bottom() + 14.0), Align2::LEFT_CENTER, name, t.semibold(13.0), t.text);
+ let photos = if person.count == 1 { "1 photo".to_string() } else { format!("{} photos", person.count) };
+ p.text(pos2(r.left() + 2.0, face.bottom() + 32.0), Align2::LEFT_CENTER, photos, t.font(12.0), t.text_dim);
+ if resp.on_hover_text(format!("{} — show their photos", person.name)).clicked() {
+ let _ = app.run("library.filter", json!({"person": person.name}));
+ let _ = app.run("view.photoGrid", json!({}));
+ }
+}
diff --git a/crates/ui-egui/src/state.rs b/crates/ui-egui/src/state.rs
index 1a4446e3a..8e14cabb5 100644
--- a/crates/ui-egui/src/state.rs
+++ b/crates/ui-egui/src/state.rs
@@ -16,6 +16,8 @@ pub enum ViewMode {
Survey,
/// A reference photo (left, fixed) beside the active photo (right, being edited).
Reference,
+ /// A card per person named on faces (close-up, name, photo count).
+ People,
}
/// The right-hand tool/panel shown next to the tool strip.
diff --git a/docs/parity.md b/docs/parity.md
index fd9f57ea3..c73133b8f 100644
--- a/docs/parity.md
+++ b/docs/parity.md
@@ -145,7 +145,7 @@ under the UI command that wraps it (a no-op error); the UI command now wins.
| LR-LIB-FLAG | Pick / reject flags | P0 | ✅ | `cmd:photo.pick`, `cmd:photo.reject`, `cmd:photo.unflag`, `cmd:photo.flag` | pick key is P (see Shortcuts); no flag cycle |
| LR-LIB-LABEL | Colour labels | P1 | ✅ | `cmd:photo.label`, `cmd:label.setNames`, `cmd:label.names`, `cmd:dialog.labelNames`, keys 6–9 in `crates/ui-egui/src/shortcuts.rs` | Photo menu and grid context menu (coloured, named), Info-panel swatches, label dot in grid cells; editable label names (undoable, journaled); no purple key (as in Lightroom), no custom extra labels |
| LR-LIB-KEYWORD | Keywords | P0 | ✅ | `cmd:panel.keywords`, `cmd:photo.setMeta` (`addKeywords`/`removeKeywords`), `cmd:keyword.list`, `cmd:keyword.rename`, `cmd:keyword.delete`, `cmd:keyword.merge`, `cmd:keyword.suggest`, `crates/catalog/src/keywords.rs`, `crates/ui-egui/src/panels/left.rs` | left-panel keyword tree with counts (click filters, children included; context menu rename / merge / delete / add / remove); library-wide ops are one undo step and replay from the op log; suggestions (co-occurring / most used / completions) in the Keywords panel; no keyword drag-and-drop |
-| LR-LIB-PEOPLE | People / faces | P2 | 🟡 | `cmd:library.filter`, `crates/ui-egui/src/panels/left.rs` (`people_section`), `crates/catalog/src/query.rs` (`people`), `crates/meta/src/xmp.rs` | MVP: named face regions read from XMP (MWG-RS, read-only) are listed with photo counts in the left panel's People section; a click filters the grid (`person` in `library.filter`, `person:` search token, filter chip); no face detection, no identity/suggestions, no manual tagging, no writing regions back |
+| LR-LIB-PEOPLE | People / faces | P2 | 🟡 | `cmd:view.people`, `cmd:library.filter`, `crates/ui-egui/src/panels/people.rs`, `crates/catalog/src/query.rs` (`people`), `crates/engine/src/media.rs` (`face_job`), `crates/meta/src/xmp.rs` | MVP: named face regions read from XMP (MWG-RS, read-only; Lightroom's quarter-turn `Rotation` handled) become cards in the People view (View ▸ People, or the People button in the toolbar): a close-up of the person's largest face, name and photo count; a click filters the grid (`person` in `library.filter`, `person:` search token, filter chip). No face detection, no unnamed people / suggestions, no manual tagging, no writing regions back |
| LR-LIB-STACK | Stacks | P1 | ✅ | `cmd:stack.group`, `cmd:stack.ungroup`, `cmd:stack.toggle`, `cmd:stack.setTop`, `cmd:stack.remove`, `cmd:stack.auto`, `crates/catalog/src/stacks.rs` | grid/filmstrip count badges, expand/collapse, auto-stack by capture time; no visual-similarity auto-stack |
| LR-LIB-VERSIONS | Versions | P1 | ✅ | `cmd:version.create` | see section M |
| LR-LIB-DELETE | Delete / Recently Deleted | P0 | ✅ | `cmd:photo.delete`, `cmd:photo.restore`, `cmd:photo.deletePermanently` | no confirmation dialog, no auto-purge after N days, no "Empty" |
@@ -195,7 +195,7 @@ under the UI command that wraps it (a no-op error); the UI command now wins.
| LR-FILT-KEYWORD | Keyword filter | P1 | ✅ | `cmd:library.filter` (`keyword`), `crates/ui-egui/src/panels/filterbar.rs` | keyword picker |
| LR-FILT-CAMERA | Camera / lens filter | P1 | ✅ | `cmd:library.filter` (`camera`, `lens`), `crates/ui-egui/src/panels/filterbar.rs` | camera and lens pickers |
| LR-FILT-LOCATION | Location filter | P2 | ✅ | `cmd:library.filter` (`text`, `ruleSet` field `location`) | free text, or a rule on location / city / state / country (smart albums, `library.filter`) |
-| LR-FILT-PEOPLE | People filter | P2 | 🟡 | `cmd:library.filter`, `crates/catalog/src/query.rs` | filter by a person's name (case-insensitive, named Face regions only); no unnamed / suggested people |
+| LR-FILT-PEOPLE | People filter | P2 | 🟡 | `cmd:library.filter`, `crates/catalog/src/query.rs` | filter by a person's name (case-insensitive, named Face regions only) from the People view, a filter chip or `person:`; no unnamed / suggested people |
| LR-FILT-CULL | Culling-score filters | P2 | ✅ | `cmd:library.filter` (`ruleSet` fields `sharpness`, `bestOfGroup`) | Focus and Best of Similar Shots in the rule editor / smart albums |
| LR-FILT-SORT | Sort | P0 | ✅ | `cmd:library.sort`, `crates/ui-egui/src/panels/bottombar.rs` | no colour-label or custom (manual) order |
| LR-FILT-SAVED | Filter presets [Classic] | P2 | ✅ | `cmd:filter.savePreset`, `cmd:filter.applyPreset`, `cmd:filter.presets`, `cmd:filter.deletePreset`, `crates/ui-egui/src/panels/filterbar.rs` | filter bar → Presets: apply, save current filter, delete (right-click); saved with the library |
@@ -724,7 +724,7 @@ From `08-lightroom-classic-extras.md` (Classic-only features) and part 2 of `06-
| LRC-LIB-KEYWORDS | Hierarchical keywords, sets, painter | P1 | ✅ | `crates/catalog/src/keywords.rs`, `cmd:keyword.list`, `cmd:keyword.sets`, `cmd:keyword.toggleFromSet`, `cmd:keyword.saveSet`, `cmd:tool.keywordPainter` | hierarchical `a\|b\|c` keywords (tree, parent filters include children, rename moves children); keyword sets + Recent Keywords (⌥1–⌥9); keyword painter (Keywords panel ▸ Paint: click photos in the grid to toggle a keyword, Esc stops) |
| LRC-LIB-METADATA | Metadata panel & presets | P1 | ✅ | `cmd:photo.setMeta`, `cmd:metadata.savePreset`, `cmd:metadata.applyPreset`, `cmd:metadata.presets`, `cmd:metadata.deletePreset`, `cmd:dialog.captureTime` | IPTC core, accessibility, place, capture-time edit; copyright status (unknown / copyrighted / public domain), rights usage terms and copyright info URL (`photo.setMeta` `copyrightStatus`, `usageTerms`, `copyrightUrl`; XMP Rights Management fields, kept by "copyright only" exports, a smart-album rule); metadata presets (Photo → Metadata Preset, Save Metadata Preset… from the active photo; applied on import from Settings) |
| LRC-LIB-QUICKDEV | Quick develop | P2 | ✅ | `cmd:develop.quickAdjust`, `crates/ui-egui/src/panels/edit.rs` (`quick_develop`) | grid with several photos selected: Edit panel ▸ Quick Develop steps (exposure ⅓ / 1 stop, contrast, highlights, shadows, whites, blacks, clarity, vibrance, temperature) added to each photo's own value, one undo step |
-| LRC-LIB-PEOPLE | People view | P2 | 🟡 | `cmd:library.filter`, `crates/ui-egui/src/panels/left.rs` (`people_section`) | a People list in the sidebar (names and counts) that filters the grid; no face-cluster grid or per-person view yet |
+| LRC-LIB-PEOPLE | People view | P2 | 🟡 | `cmd:view.people`, `crates/ui-egui/src/panels/people.rs` | Named People cards (face close-up, name, photos); no Unnamed People, no per-person page, no confirm / reject |
| LRC-LIB-COMMENTS | Comments panel | P2 | ⬜ | | |
| LRC-LIB-VISUALSEARCH | Find similar photos | P2 | ✅ | `cmd:library.findSimilar`, `crates/pipeline/src/cull.rs` (`signature`) | photo menu / Photo ▸ Find Similar Photos: look-alike photos (composition and tones), most similar first, as a filter (`only`) |
| LRC-LIB-MISSING | Missing files & relink | P1 | ✅ | `cmd:library.missing`, `cmd:photo.relink`, `cmd:library.findMissing`, `cmd:file.findMissing`, `cmd:photo.locate`, `crates/engine/src/cmd/missing.rs` (`checked_path`) | File → Find Missing Photos… (anywhere in a folder: same name, size and content hash; renamed files by size + content hash; same name and size alone only when unambiguous — look-alikes are skipped and reported; searched on a worker thread, one undo step), photo menu → Locate Missing File…; unreadable files show "!" in the grid and a reason in the loupe; undo never moves files. Missing Photos in the sidebar (counted on a worker thread; the view, the Info panel, the grid's context menu and thumbnails read file availability from a cache a worker thread fills, so an offline NAS never stalls a frame); it covers library photos only — Local browse records are never checked, for the count, the view, `library.missing` and Find Missing alike |