Skip to content

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

LR-META-EXIF-FULL: All Metadata — every EXIF / GPS / XMP field of the file

Brandon Thomasdef15b0346d6
diff --git a/crates/engine/src/cmd/query.rs b/crates/engine/src/cmd/query.rs
index 07caaae91..73a29226d 100644
--- a/crates/engine/src/cmd/query.rs
+++ b/crates/engine/src/cmd/query.rs
@@ -95,6 +95,29 @@ pub fn specs() -> Vec<CommandSpec> {
"clipboard": s.clipboard.is_some(),
}))
}),
+ cmd!(query "photo.allMetadata", "All Metadata", [], None, "{id?} → {exif: [{group, tag, name, value}], xmp: [{name, value}]} — every EXIF / TIFF / GPS tag of the file and its XMP properties", always, |s, p| {
+ let id = photo_arg(s, p, "photo.allMetadata")?;
+ let ph = s.catalog.photo(id).ok_or_else(|| super::bad("photo.allMetadata", "no such photo"))?.clone();
+ let lightcraft_catalog::Source::File { path } = &ph.source else {
+ return Ok(json!({"exif": [], "xmp": [], "note": "a generated demo photo has no file"}));
+ };
+ let bytes = match &s.media.file_bytes {
+ Some(r) => r(path),
+ None => std::fs::read(path).map_err(|e| format!("{path}: {e}")),
+ }
+ .map_err(|e| super::bad("photo.allMetadata", e))?;
+ let exif: Vec<Value> = lightcraft_meta::file_tag_rows(&bytes)
+ .into_iter()
+ .map(|r| json!({"group": r.group, "tag": r.tag, "name": r.name, "value": r.value}))
+ .collect();
+ // XMP: the sidecar if there is one, else the file's own packet
+ let packet = crate::sidecar::read_packet(path, ph.kind, s.xmp.naming).map(|(x, _)| x).or_else(|| lightcraft_meta::embedded(&bytes).xmp);
+ let xmp: Vec<Value> = packet
+ .and_then(|x| lightcraft_meta::parse_xmp(&x).ok())
+ .map(|d| d.properties.into_iter().filter(|(k, _)| !k.starts_with("lc:")).map(|(k, v)| json!({"name": k, "value": v.join("; ")})).collect())
+ .unwrap_or_default();
+ Ok(json!({"exif": exif, "xmp": xmp}))
+ }),
cmd!(query "albums.list", "List Albums", [], None, "{}", always, |s, _| {
let all: Vec<Album> = s.catalog.albums().cloned().collect();
Ok(Value::Array(all.iter().filter(|a| a.parent.is_none()).map(|a| album_json(a, &all, &s.catalog)).collect()))
diff --git a/crates/engine/src/tests_xmp.rs b/crates/engine/src/tests_xmp.rs
index c2aa158fd..fffe7ee82 100644
--- a/crates/engine/src/tests_xmp.rs
+++ b/crates/engine/src/tests_xmp.rs
@@ -249,3 +249,25 @@ fn demo_photos_have_no_sidecar() {
assert_eq!(r["written"].as_array().unwrap().len(), 0);
assert_eq!(r["failed"].as_array().unwrap().len(), 1);
}
+
+/// All Metadata: EXIF rows from the file and its XMP, for a photo on disk.
+#[test]
+fn all_metadata_lists_exif_and_xmp() {
+ let dir = temp_dir("allmeta");
+ let path = dir.join("tagged.jpg");
+ let img = lightcraft_raster::Rgba8 { width: 16, height: 8, data: vec![[90, 120, 200, 255]; 128] };
+ let exif = lightcraft_meta::write_exif(&lightcraft_meta::Metadata { make: Some("Maker".into()), iso: Some(800), ..Default::default() });
+ let meta = lightcraft_codecs::EncodeMeta { exif: Some(&exif), ..Default::default() };
+ let jpg = lightcraft_codecs::encode_jpeg(&lightcraft_codecs::EncodeImage::rgba8(&img), 90, Default::default(), &meta).unwrap();
+ std::fs::write(&path, jpg).unwrap();
+ let mut s = Session::new().with_fs();
+ s.execute("library.import", &json!({"paths": [path.to_string_lossy()]})).unwrap();
+ s.execute("photo.setMeta", &json!({"title": "A title"})).unwrap();
+ s.execute("photo.saveMetadataToFile", &json!({})).unwrap();
+ let r = s.execute("photo.allMetadata", &json!({})).unwrap();
+ let exif = r["exif"].as_array().unwrap();
+ assert!(exif.iter().any(|e| e["name"] == "Make" && e["value"] == "Maker"), "{r}");
+ assert!(exif.iter().any(|e| e["name"] == "ISO Speed" && e["value"] == "800"));
+ assert!(r["xmp"].as_array().unwrap().iter().any(|x| x["name"] == "dc:title" && x["value"] == "A title"), "the sidecar's fields: {r}");
+ let _ = std::fs::remove_dir_all(&dir);
+}
diff --git a/crates/meta/src/lib.rs b/crates/meta/src/lib.rs
index 052cbd6c7..31132c5bd 100644
--- a/crates/meta/src/lib.rs
+++ b/crates/meta/src/lib.rs
@@ -13,6 +13,7 @@ mod container;
mod datetime;
mod exif;
mod iptc;
+pub mod tags;
mod xmp;
pub use container::{Embedded, embedded, jpeg_segments, png_chunks, webp_chunks};
@@ -20,6 +21,7 @@ pub use datetime::DateTime;
pub use exif::{from_tiff, read_exif, strip_exif_header, try_read_exif, write_exif};
pub use iptc::parse_iptc;
pub use lightcraft_geom::Orientation;
+pub use tags::{TagRow, file_tag_rows, tag_rows};
pub use xmp::{CRS_NS, LC_NS, XmpData, XmpError, XmpValue, parse_xmp, write_xmp, write_xmp_lc};
use serde::{Deserialize, Serialize};
diff --git a/crates/meta/src/tags.rs b/crates/meta/src/tags.rs
new file mode 100644
index 000000000..54e6cf7e2
--- /dev/null
+++ b/crates/meta/src/tags.rs
@@ -0,0 +1,331 @@
+//! Every EXIF / TIFF / GPS tag of a file as readable `(group, name, value)` rows (the Info
+//! panel's "All Metadata"). Names follow the public TIFF 6.0 / EXIF 2.3 / DNG specifications;
+//! common enumerations are spelled out, everything else is shown as stored. Maker notes and
+//! binary blobs are summarised by size.
+
+use lightcraft_tiff::{Ifd, Tiff, Value};
+
+/// One metadata row.
+#[derive(Clone, Debug, PartialEq)]
+pub struct TagRow {
+ /// `TIFF`, `EXIF`, `GPS`, `Interop`.
+ pub group: &'static str,
+ pub tag: u16,
+ pub name: String,
+ pub value: String,
+}
+
+const NAMES: &[(u16, &str)] = &[
+ // TIFF / IFD0
+ (0x00fe, "Subfile Type"),
+ (0x0100, "Image Width"),
+ (0x0101, "Image Height"),
+ (0x0102, "Bits Per Sample"),
+ (0x0103, "Compression"),
+ (0x0106, "Photometric Interpretation"),
+ (0x010e, "Image Description"),
+ (0x010f, "Make"),
+ (0x0110, "Model"),
+ (0x0112, "Orientation"),
+ (0x0115, "Samples Per Pixel"),
+ (0x0116, "Rows Per Strip"),
+ (0x0214, "Reference Black/White"),
+ (0x9216, "TIFF/EP Standard ID"),
+ (0x828d, "CFA Repeat Pattern Dim"),
+ (0x828e, "CFA Pattern"),
+ (0xa302, "CFA Pattern"),
+ (0x9217, "Sensing Method"),
+ (0xc4a5, "Print Image Matching"),
+ (0xa500, "Gamma"),
+ (0x011a, "X Resolution"),
+ (0x011b, "Y Resolution"),
+ (0x011c, "Planar Configuration"),
+ (0x0128, "Resolution Unit"),
+ (0x0131, "Software"),
+ (0x0132, "Date/Time Modified"),
+ (0x013b, "Artist"),
+ (0x013e, "White Point"),
+ (0x013f, "Primary Chromaticities"),
+ (0x0213, "YCbCr Positioning"),
+ (0x8298, "Copyright"),
+ (0xc612, "DNG Version"),
+ (0xc614, "Unique Camera Model"),
+ (0xc62f, "Camera Serial Number"),
+ // EXIF
+ (0x829a, "Exposure Time"),
+ (0x829d, "F-Number"),
+ (0x8822, "Exposure Program"),
+ (0x8824, "Spectral Sensitivity"),
+ (0x8827, "ISO Speed"),
+ (0x8830, "Sensitivity Type"),
+ (0x8832, "Recommended Exposure Index"),
+ (0x9000, "Exif Version"),
+ (0x9003, "Date/Time Original"),
+ (0x9004, "Date/Time Digitized"),
+ (0x9010, "Offset Time"),
+ (0x9011, "Offset Time Original"),
+ (0x9012, "Offset Time Digitized"),
+ (0x9101, "Components Configuration"),
+ (0x9102, "Compressed Bits Per Pixel"),
+ (0x9201, "Shutter Speed Value"),
+ (0x9202, "Aperture Value"),
+ (0x9203, "Brightness Value"),
+ (0x9204, "Exposure Compensation"),
+ (0x9205, "Max Aperture Value"),
+ (0x9206, "Subject Distance"),
+ (0x9207, "Metering Mode"),
+ (0x9208, "Light Source"),
+ (0x9209, "Flash"),
+ (0x920a, "Focal Length"),
+ (0x9214, "Subject Area"),
+ (0x927c, "Maker Note"),
+ (0x9286, "User Comment"),
+ (0x9290, "Sub-second Time"),
+ (0x9291, "Sub-second Time Original"),
+ (0x9292, "Sub-second Time Digitized"),
+ (0xa000, "FlashPix Version"),
+ (0xa001, "Color Space"),
+ (0xa002, "Pixel X Dimension"),
+ (0xa003, "Pixel Y Dimension"),
+ (0xa20e, "Focal Plane X Resolution"),
+ (0xa20f, "Focal Plane Y Resolution"),
+ (0xa210, "Focal Plane Resolution Unit"),
+ (0xa215, "Exposure Index"),
+ (0xa217, "Sensing Method"),
+ (0xa300, "File Source"),
+ (0xa301, "Scene Type"),
+ (0xa401, "Custom Rendered"),
+ (0xa402, "Exposure Mode"),
+ (0xa403, "White Balance"),
+ (0xa404, "Digital Zoom Ratio"),
+ (0xa405, "Focal Length in 35mm Film"),
+ (0xa406, "Scene Capture Type"),
+ (0xa407, "Gain Control"),
+ (0xa408, "Contrast"),
+ (0xa409, "Saturation"),
+ (0xa40a, "Sharpness"),
+ (0xa40c, "Subject Distance Range"),
+ (0xa420, "Image Unique ID"),
+ (0xa430, "Camera Owner Name"),
+ (0xa431, "Body Serial Number"),
+ (0xa432, "Lens Specification"),
+ (0xa433, "Lens Make"),
+ (0xa434, "Lens Model"),
+ (0xa435, "Lens Serial Number"),
+ // GPS
+ (0x0000, "GPS Version"),
+ (0x0001, "GPS Latitude Ref"),
+ (0x0002, "GPS Latitude"),
+ (0x0003, "GPS Longitude Ref"),
+ (0x0004, "GPS Longitude"),
+ (0x0005, "GPS Altitude Ref"),
+ (0x0006, "GPS Altitude"),
+ (0x0007, "GPS Time Stamp"),
+ (0x000c, "GPS Speed Ref"),
+ (0x000d, "GPS Speed"),
+ (0x0010, "GPS Img Direction Ref"),
+ (0x0011, "GPS Img Direction"),
+ (0x0012, "GPS Map Datum"),
+ (0x001d, "GPS Date Stamp"),
+];
+
+/// GPS tags reuse low numbers, so they are looked up separately.
+fn name(group: &str, tag: u16) -> String {
+ let gps = group == "GPS";
+ NAMES
+ .iter()
+ .find(|(t, n)| *t == tag && (n.starts_with("GPS") == gps || (gps && tag > 0x1f)))
+ .map(|(_, n)| n.to_string())
+ .unwrap_or_else(|| format!("Tag 0x{tag:04X}"))
+}
+
+fn rational(n: f64, d: f64) -> String {
+ if d == 0.0 {
+ return "—".into();
+ }
+ let v = n / d;
+ if (v - v.round()).abs() < 1e-9 { format!("{}", v.round()) } else { format!("{:.4}", v).trim_end_matches('0').to_string() }
+}
+
+fn list<T: ToString>(v: &[T]) -> String {
+ let shown: Vec<String> = v.iter().take(16).map(|x| x.to_string()).collect();
+ if v.len() > 16 { format!("{} … ({} values)", shown.join(", "), v.len()) } else { shown.join(", ") }
+}
+
+/// Spelled-out enumerations for the commonest tags.
+fn enumerated(group: &str, tag: u16, v: i64) -> Option<&'static str> {
+ if group == "GPS" {
+ return None;
+ }
+ Some(match (tag, v) {
+ (0x0112, 1) => "Horizontal (normal)",
+ (0x0112, 3) => "Rotated 180°",
+ (0x0112, 6) => "Rotated 90° CW",
+ (0x0112, 8) => "Rotated 90° CCW",
+ (0x0112, 2) => "Mirrored horizontally",
+ (0x0112, 4) => "Mirrored vertically",
+ (0x0103, 1) => "Uncompressed",
+ (0x0103, 6) => "JPEG (old-style)",
+ (0x0103, 7) => "JPEG",
+ (0x0103, 8) => "Deflate",
+ (0x0103, 32773) => "PackBits",
+ (0x0103, 34892) => "Lossy JPEG",
+ (0x0106, 0) => "WhiteIsZero",
+ (0x0106, 1) => "BlackIsZero",
+ (0x0106, 2) => "RGB",
+ (0x0106, 6) => "YCbCr",
+ (0x0106, 32803) => "Color Filter Array",
+ (0x0106, 34892) => "Linear Raw",
+ (0x011c, 1) => "Chunky",
+ (0x011c, 2) => "Planar",
+ (0x0128, 2) => "inches",
+ (0x0128, 3) => "centimetres",
+ (0x8822, 1) => "Manual",
+ (0x8822, 2) => "Program",
+ (0x8822, 3) => "Aperture priority",
+ (0x8822, 4) => "Shutter priority",
+ (0x9207, 2) => "Center-weighted average",
+ (0x9207, 3) => "Spot",
+ (0x9207, 5) => "Pattern",
+ (0xa001, 1) => "sRGB",
+ (0xa001, 0xffff) => "Uncalibrated",
+ (0xa402, 0) => "Auto",
+ (0xa402, 1) => "Manual",
+ (0xa402, 2) => "Auto bracket",
+ (0xa403, 0) => "Auto",
+ (0xa403, 1) => "Manual",
+ (0xa406, 0) => "Standard",
+ (0xa406, 1) => "Landscape",
+ (0xa406, 2) => "Portrait",
+ (0xa406, 3) => "Night",
+ (0x9209, 0) => "No flash",
+ (0x9209, 1) => "Fired",
+ (0x9209, 5) => "Fired, return not detected",
+ (0x9209, 7) => "Fired, return detected",
+ (0x9209, 9) => "On, fired",
+ (0x9209, 16) => "Off, did not fire",
+ (0x9209, 24) => "Auto, did not fire",
+ (0x9209, 25) => "Auto, fired",
+ (0x9209, 32) => "No flash function",
+ (0x9208, 0) => "Unknown",
+ (0x9208, 1) => "Daylight",
+ (0x9208, 2) => "Fluorescent",
+ (0x9208, 3) => "Tungsten",
+ (0x9208, 4) => "Flash",
+ _ => return None,
+ })
+}
+
+fn value_text(group: &str, tag: u16, v: &Value) -> String {
+ let single = |x: i64| enumerated(group, tag, x).map(str::to_string).unwrap_or_else(|| x.to_string());
+ match v {
+ Value::Ascii(s) => s.trim().to_string(),
+ Value::Short(a) if a.len() == 1 => single(a[0] as i64),
+ Value::Long(a) if a.len() == 1 => single(a[0] as i64),
+ Value::Short(a) => list(a),
+ Value::Long(a) => list(a),
+ Value::SShort(a) => list(a),
+ Value::SLong(a) => list(a),
+ Value::Long8(a) => list(a),
+ Value::SLong8(a) => list(a),
+ Value::Float(a) => list(a),
+ Value::Double(a) => list(a),
+ Value::Rational(a) if tag == 0x829a && group != "GPS" && a.len() == 1 && a[0].1 != 0 => {
+ // exposure time as a fraction of a second
+ let (n, d) = a[0];
+ let s = n as f64 / d as f64;
+ if s >= 1.0 || n == 0 { format!("{} s", rational(n as f64, d as f64)) } else { format!("1/{} s", (1.0 / s).round()) }
+ }
+ Value::Rational(a) if tag == 0x829d && group != "GPS" && a.len() == 1 => format!("f/{}", rational(a[0].0 as f64, a[0].1 as f64)),
+ Value::Rational(a) if tag == 0x920a && group != "GPS" && a.len() == 1 => format!("{} mm", rational(a[0].0 as f64, a[0].1 as f64)),
+ Value::Rational(a) => a.iter().map(|(n, d)| rational(*n as f64, *d as f64)).collect::<Vec<_>>().join(", "),
+ Value::SRational(a) => a.iter().map(|(n, d)| rational(*n as f64, *d as f64)).collect::<Vec<_>>().join(", "),
+ Value::Byte(b) | Value::Undefined(b) => {
+ // version tags and short printable values read as text
+ let printable = b.len() <= 64 && b.iter().all(|c| c.is_ascii_graphic() || *c == b' ' || *c == 0);
+ if printable && !b.is_empty() {
+ String::from_utf8_lossy(b).trim_end_matches('\0').trim().to_string()
+ } else if b.len() <= 8 {
+ list(b)
+ } else {
+ format!("({} bytes)", b.len())
+ }
+ }
+ Value::SByte(a) => list(a),
+ Value::Ifd(a) => format!("(IFD at {})", list(a)),
+ Value::Ifd8(a) => format!("(IFD at {})", list(a)),
+ }
+}
+
+fn rows_of(group: &'static str, ifd: &Ifd, out: &mut Vec<TagRow>) {
+ for e in &ifd.entries {
+ // pointers to other IFDs and image data are structure, not metadata
+ if matches!(e.tag, 0x8769 | 0x8825 | 0xa005 | 0x014a | 0x0111 | 0x0117 | 0x0144 | 0x0145 | 0x0201 | 0x0202 | 0x02bc | 0x83bb | 0x8773)
+ && group != "GPS"
+ {
+ continue;
+ }
+ out.push(TagRow { group, tag: e.tag, name: name(group, e.tag), value: value_text(group, e.tag, &e.value) });
+ }
+}
+
+/// Every tag of a parsed TIFF structure (a TIFF-based raw, a TIFF, or an EXIF block): IFD0,
+/// then the EXIF, GPS and interoperability IFDs.
+pub fn tag_rows(tiff: &Tiff) -> Vec<TagRow> {
+ let mut out = Vec::new();
+ if let Some(ifd0) = tiff.ifds.first() {
+ rows_of("TIFF", ifd0, &mut out);
+ if let Some(e) = &ifd0.exif {
+ rows_of("EXIF", e, &mut out);
+ if let Some(i) = &e.interop {
+ rows_of("Interop", i, &mut out);
+ }
+ }
+ if let Some(g) = &ifd0.gps {
+ rows_of("GPS", g, &mut out);
+ }
+ }
+ out
+}
+
+/// [`tag_rows`] of a file's bytes: a TIFF-based file directly, else its embedded EXIF block
+/// (JPEG, PNG, WebP, HEIF…). Empty when there is none.
+pub fn file_tag_rows(bytes: &[u8]) -> Vec<TagRow> {
+ if Tiff::sniff(bytes).is_some()
+ && let Ok(t) = Tiff::parse(bytes)
+ {
+ return tag_rows(&t);
+ }
+ let Some(exif) = crate::embedded(bytes).exif else { return Vec::new() };
+ Tiff::parse(crate::strip_exif_header(&exif)).map(|t| tag_rows(&t)).unwrap_or_default()
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+
+ #[test]
+ fn rows_from_written_exif() {
+ let m = crate::Metadata {
+ make: Some("Maker".into()),
+ model: Some("Model X".into()),
+ exposure_time: Some(1.0 / 250.0),
+ f_number: Some(2.8),
+ iso: Some(400),
+ focal_length: Some(35.0),
+ gps: Some(crate::Gps { latitude: 51.5, longitude: -0.12, altitude: Some(20.0) }),
+ ..Default::default()
+ };
+ let exif = crate::write_exif(&m);
+ let t = Tiff::parse(crate::strip_exif_header(&exif)).unwrap();
+ let rows = tag_rows(&t);
+ let get = |n: &str| rows.iter().find(|r| r.name == n).map(|r| r.value.clone());
+ assert_eq!(get("Make").as_deref(), Some("Maker"));
+ assert_eq!(get("Exposure Time").as_deref(), Some("1/250 s"));
+ assert_eq!(get("F-Number").as_deref(), Some("f/2.8"));
+ assert_eq!(get("Focal Length").as_deref(), Some("35 mm"));
+ assert_eq!(get("ISO Speed").as_deref(), Some("400"));
+ assert!(rows.iter().any(|r| r.group == "GPS" && r.name == "GPS Latitude"), "{rows:?}");
+ assert!(!rows.iter().any(|r| r.tag == 0x8769), "IFD pointers are left out");
+ }
+}
diff --git a/crates/ui-egui/src/menus.rs b/crates/ui-egui/src/menus.rs
index a544b8069..17453e793 100644
--- a/crates/ui-egui/src/menus.rs
+++ b/crates/ui-egui/src/menus.rs
@@ -81,6 +81,7 @@ pub const UI_COMMANDS: &[UiCommand] = &[
("dialog.newAlbum", "New Album…", Some("Cmd+N"), "File"),
("dialog.newFolder", "New Folder…", Some("Cmd+Shift+N"), "File"),
("dialog.smartAlbum", "New Smart Album…", None, "File"),
+ ("dialog.allMetadata", "All Metadata…", None, "Photo"),
("dialog.newSmartAlbum", "New Smart Album from Filter…", Some("Cmd+Alt+N"), "File"),
("dialog.createPreset", "Create Preset…", Some("Cmd+Shift+P"), "Photo"),
("dialog.autoStack", "Auto-Stack by Capture Time…", None, "Photo>Stack"),
@@ -543,6 +544,15 @@ pub fn run_ui_command(app: &mut LightcraftApp, id: &str, p: &Value) -> Option<Re
app.ui.dialog = Some(Dialog::AutoStack { gap: p.get("gap").and_then(Value::as_f64).unwrap_or(60.0) as f32 });
Ok(Value::Null)
}
+ "dialog.allMetadata" => {
+ let r = match app.session.execute("photo.allMetadata", p) {
+ Ok(r) => r,
+ Err(e) => return Some(Err(e.to_string())),
+ };
+ let title = app.session.active().and_then(|id| app.session.catalog.photo(id)).map(|p| p.file_name.clone()).unwrap_or_default();
+ app.ui.dialog = Some(Dialog::AllMetadata { title, rows: r, search: String::new() });
+ Ok(Value::Null)
+ }
"dialog.smartAlbum" => {
// {id?}: edit that smart album's rules; without: a new one starting at Rating ≥ 3
let album = p
diff --git a/crates/ui-egui/src/panels/dialogs.rs b/crates/ui-egui/src/panels/dialogs.rs
index 431d95a9c..7b3e412ce 100644
--- a/crates/ui-egui/src/panels/dialogs.rs
+++ b/crates/ui-egui/src/panels/dialogs.rs
@@ -30,6 +30,7 @@ pub fn show(app: &mut LightcraftApp, ctx: &egui::Context) {
Dialog::RenameKeyword { .. } => "Rename Keyword",
Dialog::MergeKeywords { .. } => "Merge Keywords",
Dialog::NewSmartAlbum { .. } => "Create Smart Album",
+ Dialog::AllMetadata { .. } => "All Metadata",
Dialog::SmartRules { id: None, .. } => "New Smart Album",
Dialog::SmartRules { .. } => "Edit Smart Album",
Dialog::AutoStack { .. } => "Auto-Stack by Capture Time",
@@ -53,6 +54,7 @@ pub fn show(app: &mut LightcraftApp, ctx: &egui::Context) {
.default_width(match dlg {
Dialog::Import { .. } => 760.0,
Dialog::SmartRules { .. } => 680.0,
+ Dialog::AllMetadata { .. } => 620.0,
_ => 380.0,
})
.show(ctx, |ui| {
@@ -73,6 +75,50 @@ pub fn show(app: &mut LightcraftApp, ctx: &egui::Context) {
egui::RichText::new(format!("Creates {} stacks from {} of {scope}", preview["stacks"], preview["photos"])).color(t.text_dim),
);
}
+ Dialog::AllMetadata { title, rows, search } => {
+ ui.label(egui::RichText::new(title.as_str()).color(t.text_label));
+ let r = ui.add(egui::TextEdit::singleline(search).hint_text("Filter fields").desired_width(f32::INFINITY));
+ crate::widgets::register(ui.ctx(), "field:metadataSearch", r.rect);
+ let q = search.trim().to_lowercase();
+ let keep = |n: &str, v: &str| q.is_empty() || n.to_lowercase().contains(&q) || v.to_lowercase().contains(&q);
+ let mut groups: Vec<(String, Vec<(String, String)>)> = Vec::new();
+ for row in rows["exif"].as_array().into_iter().flatten() {
+ let (g, n, v) = (row["group"].as_str().unwrap_or(""), row["name"].as_str().unwrap_or(""), row["value"].as_str().unwrap_or(""));
+ if !keep(n, v) {
+ continue;
+ }
+ match groups.iter_mut().find(|(x, _)| x == g) {
+ Some((_, list)) => list.push((n.into(), v.into())),
+ None => groups.push((g.into(), vec![(n.into(), v.into())])),
+ }
+ }
+ let xmp: Vec<(String, String)> = rows["xmp"]
+ .as_array()
+ .into_iter()
+ .flatten()
+ .map(|r| (r["name"].as_str().unwrap_or("").to_string(), r["value"].as_str().unwrap_or("").to_string()))
+ .filter(|(n, v)| keep(n, v))
+ .collect();
+ if !xmp.is_empty() {
+ groups.push(("XMP".into(), xmp));
+ }
+ egui::ScrollArea::vertical().max_height(440.0).auto_shrink([false, true]).show(ui, |ui| {
+ if groups.is_empty() {
+ ui.label(egui::RichText::new(rows["note"].as_str().unwrap_or("No metadata found")).color(t.text_dim));
+ }
+ for (g, list) in &groups {
+ ui.add_space(6.0);
+ ui.label(egui::RichText::new(g).font(t.semibold(12.5)).color(t.text));
+ egui::Grid::new(format!("meta-{g}")).num_columns(2).spacing([16.0, 3.0]).striped(true).show(ui, |ui| {
+ for (n, v) in list {
+ ui.label(egui::RichText::new(n).color(t.text_dim));
+ ui.add(egui::Label::new(egui::RichText::new(v).color(t.text_label)).wrap());
+ ui.end_row();
+ }
+ });
+ }
+ });
+ }
Dialog::SmartRules { name, rules, .. } => {
let r = ui.add(egui::TextEdit::singleline(name).hint_text("Name").desired_width(f32::INFINITY));
crate::widgets::register(ui.ctx(), "field:smartName", r.rect);
@@ -679,6 +725,7 @@ pub fn confirm_dialog(app: &mut LightcraftApp, dlg: &Dialog) -> Result<serde_jso
Dialog::RenameKeyword { from, to } => app.run("keyword.rename", json!({"from": from, "to": to})),
Dialog::MergeKeywords { from, into } => app.run("keyword.merge", json!({"from": from, "into": into})),
Dialog::AutoStack { gap } => app.run("stack.auto", json!({"gap": gap})),
+ Dialog::AllMetadata { .. } => Ok(serde_json::Value::Null),
Dialog::SmartRules { id, name, rules } => {
let name = if name.trim().is_empty() { "Smart Album".to_string() } else { name.trim().to_string() };
match id {
diff --git a/crates/ui-egui/src/panels/right.rs b/crates/ui-egui/src/panels/right.rs
index a14487d0b..743f3b4fb 100644
--- a/crates/ui-egui/src/panels/right.rs
+++ b/crates/ui-egui/src/panels/right.rs
@@ -468,6 +468,10 @@ fn info(app: &mut LightcraftApp, ui: &mut egui::Ui, id: PhotoId) {
format!("{:.5}° {}, {:.5}° {}", la.abs(), if la >= 0.0 { "N" } else { "S" }, lo.abs(), if lo >= 0.0 { "E" } else { "W" })
});
ui.label(egui::RichText::new(gps.unwrap_or_else(|| "—".into())).color(t.text_label));
+ ui.add_space(10.0);
+ if text_button(ui, "allMetadata", "All Metadata…", false).on_hover_text("Every EXIF, GPS and XMP field in the file").clicked() {
+ let _ = app.run("dialog.allMetadata", json!({}));
+ }
});
}
diff --git a/crates/ui-egui/src/state.rs b/crates/ui-egui/src/state.rs
index 0443cab39..5f29f010d 100644
--- a/crates/ui-egui/src/state.rs
+++ b/crates/ui-egui/src/state.rs
@@ -353,6 +353,12 @@ pub enum Dialog {
NewSmartAlbum {
name: String,
},
+ /// Every metadata field of a photo's file (`photo.allMetadata`), filtered by `search`.
+ AllMetadata {
+ title: String,
+ rows: serde_json::Value,
+ search: String,
+ },
/// Create (`id` None) or edit a smart album's rules.
SmartRules {
id: Option<u64>,
diff --git a/docs/parity.md b/docs/parity.md
index 7b76c06aa..abbe9fbd6 100644
--- a/docs/parity.md
+++ b/docs/parity.md
@@ -25,7 +25,7 @@ and prints the summary; `cargo xtask parity --write` refreshes the summary table
| B. Library management (LIB) | 19 | 0 | 6 | 2 | 9/9 (100%) | 9/9 (100%) |
| C. Views & navigation (VIEW) | 14 | 0 | 3 | 0 | 9/9 (100%) | 4/4 (100%) |
| D. Search & filter (FILT) | 9 | 1 | 3 | 0 | 4/4 (100%) | 4/4 (100%) |
-| E. Metadata (META) | 4 | 2 | 0 | 0 | 2/2 (100%) | 1/2 (50%) |
+| E. Metadata (META) | 5 | 1 | 0 | 0 | 2/2 (100%) | 2/2 (100%) |
| F. Edit panel — global adjustments (EDIT) | 41 | 1 | 6 | 1 | 28/28 (100%) | 13/14 (93%) |
| G. Profiles (PROF) | 6 | 0 | 4 | 0 | 3/3 (100%) | 2/3 (67%) |
| H. Crop & rotate (CROP) | 9 | 0 | 0 | 1 | 6/6 (100%) | 3/3 (100%) |
@@ -48,9 +48,9 @@ and prints the summary; `cargo xtask parity --write` refreshes the summary table
| Y. Menus | 73 | 4 | 8 | 8 | 46/47 (98%) | 22/23 (96%) |
| Z. Keyboard shortcuts (desktop) | 73 | 3 | 4 | 1 | 49/52 (94%) | 22/23 (96%) |
| Lightroom Classic extras | 18 | 12 | 49 | 9 | — | 17/21 (81%) |
-| **Total** | 343 | 33 | 124 | 37 | 193/198 (97%) | 130/144 (90%) |
+| **Total** | 344 | 32 | 124 | 37 | 193/198 (97%) | 131/144 (91%) |
-Weighted completion (✅ = 1, 🟡 = ½, 🚫 left out): **71.9%** of 500 in-scope rows — P0 98.7% of 198 · P1 93.8% of 144 · P2 18.4% of 158.
+Weighted completion (✅ = 1, 🟡 = ½, 🚫 left out): **72.0%** of 500 in-scope rows — P0 98.7% of 198 · P1 94.1% of 144 · P2 18.4% of 158.
<!-- /parity:summary -->
## Top gaps
@@ -194,7 +194,7 @@ under the UI command that wraps it (a no-op error); the UI command now wins.
| LR-META-LOCATION | Location editing | P2 | 🟡 | `cmd:photo.setMeta` (`location`, `city`, `state`, `country`) | place fields edited in Info, read/written as IPTC Core / Photoshop XMP; GPS read-only; no map, no geocoding |
| LR-META-COPYPASTE | Copy / paste metadata | P2 | ✅ | `cmd:photo.copyMetadata`, `cmd:photo.pasteMetadata` | title, caption, alt text, extended description, copyright, creator, place fields, keywords; `fields` picks a subset |
| LR-META-XMP | XMP read/write | P0 | ✅ | `cmd:photo.saveMetadataToFile`, `cmd:photo.readMetadataFromFile`, `cmd:library.xmpPreferences`, `crates/engine/src/sidecar.rs`, `docs/xmp-interop.md` | |
-| LR-META-EXIF-FULL | Full EXIF/IPTC [Classic] | P1 | 🟡 | `crates/meta/src/exif.rs`, `crates/meta/src/iptc.rs` | read and written on export; panel shows a subset; no metadata presets |
+| LR-META-EXIF-FULL | Full EXIF/IPTC [Classic] | P1 | ✅ | `cmd:photo.allMetadata`, `cmd:dialog.allMetadata`, `crates/meta/src/tags.rs`, `crates/meta/src/exif.rs`, `crates/meta/src/iptc.rs` | read and written on export; Info ▸ All Metadata…: every TIFF / EXIF / GPS / interop tag (named, common values spelled out) and the XMP fields, searchable; metadata presets |
## F. Edit panel — global adjustments (EDIT)