Skip to content

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

Merge PR #2849: LR-EXP-METADATA: refuse Originals with embedded place names

aionggc0df71dde6ef
diff --cc crates/engine/src/export/prepare.rs
index 0a3dce119,000000000..d71a60e0b
mode 100644,000000..100644
--- a/crates/engine/src/export/prepare.rs
+++ b/crates/engine/src/export/prepare.rs
@@@ -1,402 -1,0 +1,415 @@@
+use super::batch::run_batch;
+use super::encoding::{encode_gain_map_jpeg, encode_rendered, export_metadata, removes_location};
+use super::options::ExportFormat;
+use super::params::apple_photos_unsupported;
+use super::{ExportOptions, Metadata, OutputDepth};
+
+/// One exported file.
+pub struct Exported {
+ pub file_name: String,
+ pub bytes: Vec<u8>,
+ pub width: usize,
+ pub height: usize,
+ /// Files written next to it, named like it with another extension: `(extension, bytes)` (the
+ /// XMP sidecar of an `Original` export).
+ pub sidecars: Vec<(&'static str, Vec<u8>)>,
+ /// Set when the render was tried on the GPU and fell back to the CPU: why (see
+ /// `docs/gpu-pipeline.md`). The file holds the CPU render either way.
+ pub gpu_fallback: Option<String>,
+}
+
+/// Output size of photo `p` under `o` (its cropped full size when `o.resize` is `None`).
+pub fn output_size(p: &lightcraft_catalog::Photo, o: &ExportOptions) -> (usize, usize) {
+ let (w, h) = lightcraft_pipeline::native_output_size(p.width.max(1) as usize, p.height.max(1) as usize, &p.develop);
+ // whole pixels first: a crop's float noise (5999.999… for 6000) must not decide a half-pixel tie
+ let (w, h) = (w.round().max(1.0), h.round().max(1.0));
+ match &o.resize {
+ Some(r) => r.apply(w, h),
+ None => (w as usize, h as usize),
+ }
+}
+
+/// Render photo `id` at the requested size and encode it (or copy / convert its original for
+/// [`ExportFormat::Original`] / [`ExportFormat::Dng`]).
+pub fn export_photo(session: &mut crate::Session, id: lightcraft_catalog::PhotoId, o: &ExportOptions, seq: usize) -> Result<Exported, String> {
+ prepare_export(session, id, o, seq)?.run()
+}
+
+/// One photo's export, set up from the session ([`prepare_export`]). [`PreparedExport::run`] does
+/// the heavy part (read, decode, render, encode) without the session, so it can run on another
+/// thread.
+pub struct PreparedExport {
+ pub photo: lightcraft_catalog::PhotoId,
+ pub file_name: String,
+ /// The folder of the photo's original on disk ([`DestinationMode::SameAsOriginal`]); `None`
+ /// for a demo photo or one in the browser's storage.
+ pub source_dir: Option<String>,
+ work: Work,
+ /// The library's originals, which [`run_batch`] never writes over (shared by a batch).
+ pub(super) guard: std::sync::Arc<crate::originals::OriginalGuard>,
+ /// Estimated working memory of [`Self::run`] (bytes), held from [`crate::memory::export_gate`]
+ /// while it runs beside other photos of a batch.
+ pub(super) weight: usize,
+}
+
+struct RenderWork {
+ job: crate::media::RenderJob,
+ /// The HDR rendition of a gain map JPEG (`job` renders its SDR base).
+ hdr_job: Option<crate::media::RenderJob>,
+ meta: Option<Metadata>,
+ opts: ExportOptions,
+}
+
+enum Work {
+ Render(Box<RenderWork>),
+ /// [`ExportFormat::Original`] (the file's bytes + an XMP sidecar) or [`ExportFormat::Dng`] (the
+ /// raw data re-encoded as a lossless DNG with the edits in its XMP).
+ File {
+ path: String,
+ read: Option<crate::merge::ByteReader>,
+ packet: String,
+ dng: Option<DngCompression>,
+ /// Lossy DNG: JPEG quality and the long edge to scale to (`None`: full size).
+ quality: u8,
+ lossy_edge: Option<u32>,
+ /// The original must not carry a location ([`removes_location`]).
+ remove_location: bool,
+ label: String,
+ size: (usize, usize),
+ },
+}
+
+/// Set up the export of photo `id` at 1-based position `seq` of a batch. (For a whole batch use
+/// [`prepare_batch`]: it looks at the library's originals once.)
+pub fn prepare_export(
+ session: &mut crate::Session,
+ id: lightcraft_catalog::PhotoId,
+ o: &ExportOptions,
+ seq: usize,
+) -> Result<PreparedExport, String> {
+ let guard = std::sync::Arc::new(session.original_guard());
+ prepare_guarded(session, id, o, seq, guard)
+}
+
+/// [`prepare_export`] for each of `ids` in order (`{seq}` = position, from 1).
+pub fn prepare_batch(session: &mut crate::Session, ids: &[lightcraft_catalog::PhotoId], o: &ExportOptions) -> Result<Vec<PreparedExport>, String> {
+ let guard = std::sync::Arc::new(session.original_guard());
+ ids.iter().enumerate().map(|(i, id)| prepare_guarded(session, *id, o, i + 1, guard.clone())).collect()
+}
+
+fn prepare_guarded(
+ session: &mut crate::Session,
+ id: lightcraft_catalog::PhotoId,
+ o: &ExportOptions,
+ seq: usize,
+ guard: std::sync::Arc<crate::originals::OriginalGuard>,
+) -> Result<PreparedExport, String> {
+ let p = session.catalog.photo(id).ok_or("no such photo")?;
+ let file_name = o.file_name_for(p, seq);
+ let source_dir = original_folder(&p.source);
+ // HDR output only for photos edited in HDR; the rest of the batch exports as usual
+ let sdr_opts;
+ let o = if o.hdr && !p.develop.hdr.enabled {
+ sdr_opts = ExportOptions { hdr: false, ..o.clone() };
+ &sdr_opts
+ } else {
+ o
+ };
+ let (full_px, long) = ((p.width as usize).saturating_mul(p.height as usize), p.width.max(p.height) as usize);
+ let (work, weight) = if o.format.is_rendered() {
+ let (w, h) = output_size(p, o);
+ let (nw, nh) = lightcraft_pipeline::native_output_size(p.width.max(1) as usize, p.height.max(1) as usize, &p.develop);
+ let native_px = (nw.round().max(1.0) * nh.round().max(1.0)) as usize;
+ let label = p.file_name.clone();
+ let meta = export_metadata(p, &session.catalog, o);
+ let gain_map = o.hdr_output() && o.format == ExportFormat::Jpeg;
+ let job = session.export_job(id, w, h, o.effective_space(), o.effective_depth())?;
+ let weight = render_weight(full_px, long, job.level, w.saturating_mul(h));
+ if let Some(why) = too_big_for_memory((w, h), native_px, weight, crate::memory::total_ram()) {
+ return Err(format!("{label}: {why}"));
+ }
+ let hdr_job = if gain_map { Some(session.export_job(id, w, h, o.effective_space(), OutputDepth::F32Hdr)?) } else { None };
+ (Work::Render(Box::new(RenderWork { job, hdr_job, meta, opts: o.clone() })), weight)
+ } else {
+ let lightcraft_catalog::Source::File { path } = &p.source else {
+ return Err(format!("{} is a generated demo photo: it has no original file to export", p.file_name));
+ };
+ let dng = (o.format == ExportFormat::Dng).then_some(o.dng_compression);
+ // the file's bytes; a DNG also decodes the raw data (16-bit samples) and writes it again
+ let weight = (p.file_size as usize).saturating_add(if dng.is_some() { full_px.saturating_mul(6) } else { 0 });
+ let work = Work::File {
+ path: path.clone(),
+ read: session.media.file_bytes.clone(),
+ packet: crate::sidecar::sidecar_packet_with(p, &session.catalog, removes_location(p, &session.catalog, o)),
+ dng,
+ quality: o.quality,
+ lossy_edge: o.resize.is_some().then(|| {
+ let (w, h) = output_size(p, o);
+ u32::try_from(w.max(h)).unwrap_or(u32::MAX)
+ }),
+ remove_location: removes_location(p, &session.catalog, o),
+ label: p.file_name.clone(),
+ size: (p.width as usize, p.height as usize),
+ };
+ (work, weight)
+ };
+ Ok(PreparedExport { photo: id, file_name, source_dir, work, guard, weight })
+}
+
+/// The folder a photo's original is in, for [`DestinationMode::SameAsOriginal`]. None for a demo
+/// photo, and on the web, where an original lives in the browser's storage, not in a folder.
+fn original_folder(source: &lightcraft_catalog::Source) -> Option<String> {
+ let lightcraft_catalog::Source::File { path } = source else { return None };
+ if cfg!(target_arch = "wasm32") {
+ return None;
+ }
+ let dir = std::path::Path::new(path).parent()?.to_string_lossy().to_string();
+ (!dir.is_empty()).then_some(dir)
+}
+
+/// Why an export of `out` pixels (`w`, `h`), from a photo of `native_px` pixels at its own size,
+/// can't be made on a computer with `ram` bytes, given its working memory `weight`: an export
+/// enlarged past the photo's size that needs more memory than the computer has would fail to
+/// allocate, which ends the process rather than the export. Full-size and smaller exports, and
+/// computers whose memory isn't known, are never refused.
+pub(super) fn too_big_for_memory(out: (usize, usize), native_px: usize, weight: usize, ram: Option<usize>) -> Option<String> {
+ let ram = ram?;
+ if out.0.saturating_mul(out.1) <= native_px || weight <= ram {
+ return None;
+ }
+ let gb = |b: usize| b as f64 / (1u64 << 30) as f64;
+ Some(format!(
+ "exporting at {} × {} needs about {:.0} GB of memory, more than this computer has ({:.0} GB); choose a smaller size",
+ out.0,
+ out.1,
+ gb(weight).ceil(),
+ gb(ram)
+ ))
+}
+
+/// Working memory of rendering a photo of `full_px` pixels (long edge `long`) from source level
+/// `level` into `out_px` output pixels: the decoded source (linear RGB f32, 12 B/px) plus the
+/// pipeline's planes and the encoded output (~36 B per output pixel). Measured: a 24 MP export
+/// peaks at ~1.2 GB, one at 2048 px from the 2560 px preview at ~150 MB.
+pub(super) fn render_weight(full_px: usize, long: usize, level: crate::media::SourceLevel, out_px: usize) -> usize {
+ let edge = level.max_edge().min(long.max(1));
+ let scale = edge as f64 / long.max(1) as f64;
+ let src_px = (full_px as f64 * scale * scale).min(usize::MAX as f64 / 64.0) as usize;
+ src_px.saturating_mul(12).saturating_add(out_px.saturating_mul(36))
+}
+
+impl PreparedExport {
+ pub fn run(self) -> Result<Exported, String> {
+ let file_name = self.file_name;
+ match self.work {
+ Work::Render(w) => {
+ let RenderWork { job, hdr_job, meta, opts } = *w;
+ let result = job.run();
+ let r = result.rendered?;
+ let gpu_fallback = result.gpu_fallback;
+ let bytes = match hdr_job {
+ Some(hj) => {
+ let hr = hj.run().rendered?;
+ let hdr = hr.deep.ok_or("the HDR render has no float samples")?;
+ encode_gain_map_jpeg(&r.image, &hdr, &opts, meta.as_ref())?
+ }
+ None => encode_rendered(&r, &opts, meta.as_ref())?,
+ };
+ Ok(Exported { file_name, bytes, width: r.image.width, height: r.image.height, sidecars: Vec::new(), gpu_fallback })
+ }
+ Work::File { path, read, packet, dng, quality, lossy_edge, label, size, remove_location } => {
+ let bytes = match &read {
+ Some(r) => r(&path)?,
+ None => std::fs::read(&path).map_err(|e| format!("{path}: {e}"))?,
+ };
+ let Some(dng) = dng else {
+ // the file is copied byte for byte: refuse rather than leak a location it embeds
+ if remove_location {
+ let metadata = lightcraft_meta::try_extract(&bytes)
+ .map_err(|e| format!("{label}: can't verify location metadata in this original file: {e}"))?;
- if metadata.gps.is_some() {
++ if !bytes.starts_with(b"8BPS") {
++ let embedded = lightcraft_meta::embedded(&bytes);
++ if let Some(xmp) = embedded.xmp.as_deref() {
++ lightcraft_meta::parse_xmp(xmp).map_err(|e| {
++ format!("{label}: can't verify location metadata in this original file: malformed embedded XMP: {e}")
++ })?;
++ }
++ }
++ let embeds_place_name =
++ [metadata.sublocation.as_deref(), metadata.city.as_deref(), metadata.state.as_deref(), metadata.country.as_deref()]
++ .into_iter()
++ .flatten()
++ .any(|value| !value.trim().is_empty());
++ if metadata.gps.is_some() || embeds_place_name {
+ return Err(format!(
- "{label}: can't remove the location from an original file that embeds GPS; export as JPEG, TIFF or DNG instead"
++ "{label}: can't remove the location from an original file that embeds GPS or place names; export as JPEG or TIFF, or as DNG for a raw photo"
+ ));
+ }
+ }
+ return Ok(Exported {
+ file_name,
+ bytes,
+ width: size.0,
+ height: size.1,
+ sidecars: vec![("xmp", packet.into_bytes())],
+ gpu_fallback: None,
+ });
+ };
+ if lightcraft_raw::probe(&bytes).is_none() {
+ return Err(format!("{label}: DNG export needs a raw photo"));
+ }
+ let mut raw = lightcraft_raw::decode(&bytes).map_err(|e| format!("{label}: {e}"))?;
+ crate::camera_preview::with_starting_colour(&mut raw, &bytes);
+ drop(bytes);
+ let compression = match dng {
+ DngCompression::Lossless => lightcraft_raw::DngCompression::Lj92 { tile: 256 },
+ DngCompression::Deflate => lightcraft_raw::DngCompression::Deflate { tile: 256, half: false },
+ DngCompression::Uncompressed => lightcraft_raw::DngCompression::Uncompressed,
+ DngCompression::Lossy => {
+ lightcraft_raw::DngCompression::LossyJpeg { tile: 256, quality: quality.clamp(1, 100), long_edge: lossy_edge }
+ }
+ };
+ let dng = lightcraft_raw::write_dng(&raw, &lightcraft_raw::DngWriteOptions { xmp: Some(packet), compression, ..Default::default() })
+ .map_err(|e| e.to_string())?;
+ Ok(Exported { file_name, bytes: dng, width: raw.width, height: raw.height, sidecars: Vec::new(), gpu_fallback: None })
+ }
+ }
+ }
+}
+
+/// How an exported DNG stores its raw data.
+#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub enum DngCompression {
+ /// Lossless JPEG (the usual DNG compression).
+ #[default]
+ Lossless,
+ /// Deflate (zip) tiles with prediction.
+ Deflate,
+ Uncompressed,
+ /// Lossy DNG: demosaiced linear data as JPEG tiles at the export quality, scaled to the resize
+ /// setting when there is one (Lightroom's "Use Lossy Compression").
+ Lossy,
+}
+
+/// The destination of a batch: a folder (with `ExportOptions::subfolder` and the conflict policy
+/// applied to each file together with its sidecars; with [`DestinationMode::SameAsOriginal`] each
+/// photo's own folder instead of `dir`), or one exact file path (single photo; an ordinary file
+/// already there is replaced). Either way a catalogued original (or its sidecar)
+/// is never written over: see [`crate::originals`].
+#[derive(Clone, Debug, Default)]
+pub struct Destination {
+ pub dir: String,
+ pub exact: Option<String>,
+}
+
+/// What happens after an export has written its files (Lightroom's Post-Processing): nothing, or
+/// adding them to Apple Photos ([`ExportOptions::add_to_photos`]). Made by
+/// [`crate::Session::after_export`] before the export starts, so an export asking for something
+/// this session can't do fails before writing anything; for Photos it holds the import slot
+/// (a [`crate::apple_photos::Reservation`]) until the files are handed over, and frees it when
+/// dropped unused (the export failed or never ran). `Send`: a background export takes it to its
+/// worker.
+#[derive(Default)]
+pub struct AfterExport {
+ #[cfg(not(target_arch = "wasm32"))]
+ apple_photos: Option<crate::apple_photos::Reservation>,
+}
+
+impl AfterExport {
+ /// Add the files to Apple Photos with `runner`, into `album` when it isn't blank, reserving
+ /// the import slot of `imports` now. (Front ends get this from
+ /// [`crate::Session::after_export`], which checks the platform first.)
+ #[cfg(not(target_arch = "wasm32"))]
+ pub fn apple_photos(runner: crate::apple_photos::Runner, album: &str, imports: &crate::apple_photos::Imports) -> Result<Self, String> {
+ Ok(Self { apple_photos: Some(imports.reserve(runner, album)?) })
+ }
+
+ /// Nothing to do.
+ #[cfg(not(target_arch = "wasm32"))]
+ pub fn is_none(&self) -> bool {
+ self.apple_photos.is_none()
+ }
+
+ /// Nothing to do.
+ #[cfg(target_arch = "wasm32")]
+ pub fn is_none(&self) -> bool {
+ true
+ }
+
+ /// Do it now for an export's per-photo results ([`run_batch`]'s: only the files written
+ /// count), waiting for Photos: for a worker thread (the app's background export) or a caller
+ /// without a window (MCP, lightcraft-cli). `None` when there was nothing to do, else the
+ /// outcome to report as the export's `applePhotos`: the finished job (`{job, running: false,
+ /// requested, album}` with `{imported, ids, warning?}`, `{error}`, or `{skipped}` when the
+ /// export was cancelled or wrote nothing). Never fails the export: its files are written
+ /// either way.
+ pub fn run(self, files: &[serde_json::Value], cancelled: bool) -> Option<serde_json::Value> {
+ #[cfg(not(target_arch = "wasm32"))]
+ if let Some(r) = self.apple_photos {
+ return Some(r.run(files, cancelled));
+ }
+ let _ = (files, cancelled);
+ None
+ }
+
+ /// Like [`AfterExport::run`], without waiting: Photos works on a worker thread and the
+ /// outcome is the running job (`{job, running: true, requested, album}`; its result comes
+ /// from `export.photosImports`, and the desktop app announces it). For a caller on the UI
+ /// thread, which must not wait minutes for Photos.
+ pub fn start(self, files: &[serde_json::Value]) -> Option<serde_json::Value> {
+ #[cfg(not(target_arch = "wasm32"))]
+ if let Some(r) = self.apple_photos {
+ return Some(r.start(files));
+ }
+ let _ = files;
+ None
+ }
+
+ /// [`AfterExport::start`] where the session answers on a UI thread
+ /// ([`crate::Session::apple_photos_background`]), else [`AfterExport::run`].
+ pub fn finish(self, s: &crate::Session, files: &[serde_json::Value]) -> Option<serde_json::Value> {
+ #[cfg(not(target_arch = "wasm32"))]
+ if s.apple_photos_background {
+ return self.start(files);
+ }
+ let _ = s;
+ self.run(files, false)
+ }
+}
+
+impl crate::Session {
+ /// What an export with `o` does after writing its files; an error, before anything is written,
+ /// when it asks for Apple Photos and this platform or session has no way to reach it, or
+ /// another import is reserved or running. For Photos the import slot is reserved from now on.
+ pub fn after_export(&self, o: &ExportOptions) -> Result<AfterExport, String> {
+ if !o.add_to_photos {
+ return Ok(AfterExport::default());
+ }
+ if let Some(why) = apple_photos_unsupported() {
+ return Err(why.into());
+ }
+ #[cfg(not(target_arch = "wasm32"))]
+ {
+ let runner = self.apple_photos.clone().ok_or_else(|| crate::apple_photos::unavailable().to_string())?;
+ let mut after = AfterExport::apple_photos(runner, &o.photos_album, &self.apple_photos_imports)?;
+ after.apple_photos = after.apple_photos.map(|r| r.shown_in(self.activity.clone()));
+ Ok(after)
+ }
+ #[cfg(target_arch = "wasm32")]
+ Err("Apple Photos is only available on macOS".into())
+ }
+}
+
+/// Export `ids` in order ([`prepare_batch`] + [`run_batch`]), stopping at the first error.
+pub fn export_batch(
+ session: &mut crate::Session,
+ ids: &[lightcraft_catalog::PhotoId],
+ o: &ExportOptions,
+ to: &Destination,
+ write: &mut dyn FnMut(&str, &[u8]) -> Result<(), String>,
+ exists: &dyn Fn(&str) -> bool,
+) -> Result<Vec<serde_json::Value>, String> {
+ let items = prepare_batch(session, ids, o)?;
+ run_batch(items, o, to, write, exists, true, &mut |_, _| true)
+}
diff --cc docs/gaps.md
index 671f3089c,fbef7abc8..2f711e0f8
--- a/docs/gaps.md
+++ b/docs/gaps.md
@@@ -84,9 -84,7 +84,10 @@@ Beta-blocking gaps (B) total **~230–4
| Date | Change | Summary |
|---|---|---|
+| 2026-10-24 | minor | Gap 8: lens profile work is tracked in #329; hours unchanged |
+| 2026-10-24 | minor | Gap 28: ⌘⌥⇧C / ⌘⌥⇧V (Ctrl+Alt+Shift+C / V on Windows and Linux) copy and paste metadata; no key leaves the entry; hours unchanged |
+| 2026-10-24 | minor | Gap 30 shrinks: the Info panel's Show Metadata For (Target Photo / Selected Photos, `view.infoSelectedPhotos`) shows the selected photos' shared values and marks fields that differ as Mixed; the All Metadata dialog remains; 1–3 h (was 4–8) |
+ | 2026-10-24 | patch | LR-EXP-METADATA: Original export refuses embedded GPS or nonblank place names when Remove Location Info is on; ranked gaps, estimates and readiness unchanged |
| 2026-10-23 | minor | Gap 13: before a Lightroom catalog import the app asks whether it merges into the open library or goes into a new one (opt-out in Settings, #2672); hours unchanged |
| 2026-10-22 | patch | Gap 28: View shows the current grid-cycle key beside Photo Grid and Square Grid (#2500); no new binding and no change to the remaining shortcut gap or hours |
| 2026-10-22 | minor | Gap 15: the Print page setup and PDF gain the Japanese photo and postcard paper sizes (L判 89×127, 2L判 127×178, KG判 102×152, はがき 100×148, 往復はがき 148×200, 六切 203×254, 四切 254×305, 名刺 55×91 mm), by their customary names; gap not closed |
diff --cc docs/parity-checklist.md
index 5dadaaec4,60da38e94..74bd9b4e5
--- a/docs/parity-checklist.md
+++ b/docs/parity-checklist.md
@@@ -396,17 -396,17 +396,17 @@@ differences and missing bindings are i
| LR-EXP-BITDEPTH | Bit depth | P1 | ✅ | `cmd:app.export` (`bitDepth`), `crates/pipeline/src/output.rs` (`OutputDepth`), `crates/engine/src/export.rs` | 16-bit PNG/TIFF/JPEG XL rendered at 16 bits (TIFF defaults to 16), 32-bit float linear TIFF with a linear profile, 10-bit AVIF; high-bit-depth renders run on the CPU |
| LR-EXP-COMPRESSION | TIFF compression | P1 | ✅ | `cmd:app.export` (`tiffCompression`: none / lzw / zip) | |
| LR-EXP-COLORSPACE | Output colour space | P0 | ✅ | `cmd:app.export` (`colorSpace`), `crates/pipeline/src/output.rs`, `crates/engine/src/export.rs` | sRGB, Display P3, Adobe RGB (1998) compatible, ProPhoto RGB, Rec. 2020: rendered from the working space with gamut mapping into the target gamut (CPU + GPU), own ICC profile embedded; AVIF stays sRGB (muxer has no ICC); lossy JPEG XL declares sRGB / P3 / Rec. 2020 (Adobe RGB and ProPhoto written as Rec. 2020), lossless JPEG XL embeds the profile |
-| LR-EXP-HDR | HDR output | P2 | 🟡 | `cmd:app.export`, `crates/ui-egui/src/panels/dialogs.rs` | HDR output checkbox in the export dialog: gain map JPEG, PQ or HLG AVIF, PQ PNG, PQ JPEG XL, float TIFF; no HDR presets yet |
+| LR-EXP-HDR | HDR output | P2 | 🟡 | `cmd:app.export`, `crates/ui-egui/src/dialogs.rs` | HDR output checkbox in the export dialog: gain map JPEG, PQ or HLG AVIF, PQ PNG, PQ JPEG XL, float TIFF; no HDR presets yet |
| LR-EXP-SHARPEN | Output sharpening | P1 | ✅ | `cmd:app.export` (`sharpen`, `sharpenAmount`) | |
- | LR-EXP-METADATA | Metadata policy | P1 | ✅ | `cmd:app.export` (`metadata`, `removeLocation`) | |
+ | LR-EXP-METADATA | Metadata policy | P1 | ✅ | `cmd:app.export` (`metadata`, `removeLocation`) | Original export is refused when Remove Location Info is on and the source embeds GPS or a nonblank sublocation, city, state or country; rendered exports and XMP sidecars remove those modeled fields |
| LR-EXP-WATERMARK | Watermark | P1 | 🟡 | `cmd:app.export` (`watermark`: text, or `{text, vertical, size, opacity, anchor, insetX, insetY, inset, rotation, color, shadow, image, imageWidth}`), `crates/engine/src/export.rs` (`Watermark`, `WATERMARK_PARAMS`) | text uses Inter SemiBold, the existing Mincho-first CJK chain, then Thai faces from `CRAFT_FONTS_DIR`, shared with contact-sheet captions and slideshow overlays (#2052, partial). Horizontal Thai mark positioning remains incomplete. Arabic export fallback is deferred until joining and bidi reordering exist; UI font fallback is unchanged. Text (`size` = height as a fraction of the short edge, 0.005..0.5, default 0.035; `color` sRGB `[r,g,b]`; `shadow`; Japanese vertical glyph forms and origins, tested by `biz_ud_vertical_watermarks_place_punctuation_at_the_top_right`; extended grapheme cells keep decomposed dakuten/handakuten and Latin accents together, tested by `vertical_watermarks_keep_combining_marks_in_one_cell` and `upright_watermark_cell_retains_multiple_glyphs` (see `docs/vertical-watermarks.md`)) or a graphic with transparency (EXIF orientation applied before sizing; oversized graphics fit the rotated image bounds without stretching, tested by `graphic_watermark_honours_exif_orientation` and `graphic_watermark_keeps_aspect_when_fitted_and_rotated`; `image` path, `imageWidth` = fraction of the photo's width, 0.01..1, converted to the output colour space); `anchor` (nine positions), `insetX` / `insetY` (margins from the side and from the top/bottom edges, each a fraction of the short edge, 0..0.4; the Export dialog's Horizontal and Vertical inset sliders, as in Lightroom Classic; the older single `inset` still reads as both; tested by `watermark_insets_are_horizontal_and_vertical`), `rotation` (0, 90, 180 or 270 degrees clockwise, the Export dialog's Rotate row, as Lightroom Classic's rotate buttons; sized before it is turned, placed and inset by the turned box; tested by `watermark_rotation_turns_the_text_in_its_corner` and `graphic_watermark_is_placed_scaled_and_blended`), `opacity` 0..1. Unknown keys and out-of-range values are errors (issue #183). The Export dialog previews it on the first exported photo's thumbnail (`draw_watermark_preview` scales the 6 px minimum text size to the preview so it matches the file), tested by `watermark_preview_scales_the_minimum_text_size` and `export_dialog_previews_the_watermark` |
| LR-EXP-NAMING | File naming | P1 | ✅ | `cmd:app.export` (`naming`, `startNumber`), `crates/engine/src/rename.rs` (`expand_tokens`) | one template language for export, Rename Photos and import renaming: `{name}`, `{num}` (number at the end of the name), `{seq}` / `{seq:N}`, `{date}` / `{date:%Y-%m-%d}`, `{folder}`, `{camera}`, `{lens}`, `{iso}`, `{rating}`, `{title}`, `{creator}`, `{ext}`; free-form template rather than a list of named schemes |
-| LR-EXP-LOCATION | Destination folder | P0 | ✅ | `cmd:app.export` (`dir`, `destinationMode`: specificFolder / sameAsOriginal, `subfolder`, `conflict`: unique / overwrite / skip), `cmd:export.checkTarget`, `crates/ui-egui/src/panels/dialogs.rs` (Choose… folder picker), `crates/engine/src/originals.rs`, `crates/catalog/src/safe_file.rs` | folder picker on the desktop; Export to: Specific folder or Same folder as original photo (each photo into its original's folder + the subfolder; a demo/browser photo or a missing folder is that photo's error, issue #956); existing files get `-2`, `-3`… by default; the policy covers a file and its sidecars together; a catalogued original (or its sidecar) is never written over, whatever the policy or an exact `path` (export, `ui.render`, MCP `render_photo`, merge `previewPath`, `lightcraft-cli render`); files are written to a temp file and renamed into place (issue #93; not synced file by file — exports can be made again, issue #134) |
+| LR-EXP-LOCATION | Destination folder | P0 | ✅ | `cmd:app.export` (`dir`, `destinationMode`: specificFolder / sameAsOriginal, `subfolder`, `conflict`: unique / overwrite / skip), `cmd:export.checkTarget`, `crates/ui-egui/src/dialogs.rs` (Choose… folder picker), `crates/engine/src/originals.rs`, `crates/catalog/src/safe_file.rs` | folder picker on the desktop; Export to: Specific folder or Same folder as original photo (each photo into its original's folder + the subfolder; a demo/browser photo or a missing folder is that photo's error, issue #956); existing files get `-2`, `-3`… by default; the policy covers a file and its sidecars together; a catalogued original (or its sidecar) is never written over, whatever the policy or an exact `path` (export, `ui.render`, MCP `render_photo`, merge `previewPath`, `lightcraft-cli render`); files are written to a temp file and renamed into place (issue #93; not synced file by file — exports can be made again, issue #134) |
| LR-EXP-PREVIOUS | Export with previous settings | P0 | ✅ | `cmd:app.exportPrevious`, `cmd:dialog.export` | last options persist in prefs.json; dialog prefilled; no named export presets yet |
| LR-EXP-DNGOPT | DNG options | P2 | 🟡 | `cmd:app.export` (`dngCompression`), `crates/engine/src/export.rs` | compression: lossless JPEG (default), ZIP, none, or lossy (demosaiced linear camera RGB as 8-bit JPEG tiles at the export quality, a `LinearizationTable` restoring linear values, scaled to the resize long edge when set; `crates/raw/tests/it/lossy_dng.rs`); no embedded JPEG preview size |
-| LR-EXP-ORIGINAL | Original + XMP | P1 | ✅ | `cmd:app.export` (`format: original`), `crates/engine/src/tests_export.rs` | file copied byte for byte, sidecar named after the output and subject to the conflict policy |
+| LR-EXP-ORIGINAL | Original + XMP | P1 | ✅ | `cmd:app.export` (`format: original`), `crates/engine/src/tests/export.rs` | file copied byte for byte, sidecar named after the output and subject to the conflict policy |
| LR-EXP-RENDERDNG | Render to DNG (Classic 15.5) | P2 | 🟡 | `cmd:app.export` (`format: rendereddng`), `crates/raw/src/dngwrite.rs` (`write_rendered_dng`), `crates/raw/tests/it/rendered_dng.rs` | export format `rendereddng` (dialog: Format DNG, "DNG of: Rendered photo"): the rendered photo (edit, crop, size, sharpening, watermark baked in) as a LinearRaw DNG of 16-bit float Deflate tiles in the export colour space, with `ColorMatrix1` / `ForwardMatrix1` for that space, a neutral `AsShotNeutral` and an identity `ProfileToneCurve` so raw converters show it as rendered; HDR edits keep highlights above white. Not a menu command on selected photos (Lightroom adds the DNG to the catalog next to the original); export only |
-| LR-EXP-PHOTOS | Export to the system photo library | P2 | 🟡 | `cmd:app.export` (`addToPhotos`, `photosAlbum`), `cmd:export.addToPhotos`, `cmd:export.photosImports`, `crates/engine/src/apple_photos.rs`, `crates/ui-egui/src/panels/dialogs.rs`, `packaging/macos/entitlements.plist`, `docs/apple-photos.md` | macOS: the exported files go to Apple Photos through Apple Events to its import command (a constant AppleScript run by `/usr/bin/osascript`; album names and paths are separate arguments), into a top-level album of exactly that name, made when missing (several of that name: refused); the Export dialog's Add to Apple Photos, Export with Previous, presets, MCP and `lightcraft-cli` all reach it; imports are jobs, off the UI thread in the desktop app and awaited in one-shot headless runs, one at a time, reserved by an export before it writes; permission, missing Photos, timeouts and partial imports are reported; the packaged app carries the Apple Events entitlement and usage text. Tested end to end with the packaged app on macOS 26.6.2 / Photos 11.0 (manual steps in `docs/apple-photos.md`). Other platforms' photo libraries are not covered |
+| LR-EXP-PHOTOS | Export to the system photo library | P2 | 🟡 | `cmd:app.export` (`addToPhotos`, `photosAlbum`), `cmd:export.addToPhotos`, `cmd:export.photosImports`, `crates/engine/src/apple_photos.rs`, `crates/ui-egui/src/dialogs.rs`, `packaging/macos/entitlements.plist`, `docs/apple-photos.md` | macOS: the exported files go to Apple Photos through Apple Events to its import command (a constant AppleScript run by `/usr/bin/osascript`; album names and paths are separate arguments), into a top-level album of exactly that name, made when missing (several of that name: refused); the Export dialog's Add to Apple Photos, Export with Previous, presets, MCP and `lightcraft-cli` all reach it; imports are jobs, off the UI thread in the desktop app and awaited in one-shot headless runs, one at a time, reserved by an export before it writes; permission, missing Photos, timeouts and partial imports are reported; the packaged app carries the Apple Events entitlement and usage text. Tested end to end with the packaged app on macOS 26.6.2 / Photos 11.0 (manual steps in `docs/apple-photos.md`). Other platforms' photo libraries are not covered |
| LR-EXP-PSD | Round trip to an external editor | P2 | ✅ | `cmd:photo.editExternal`, `cmd:photo.editInPhotoCraft`, `cmd:photo.editInExternal`, `cmd:photo.openOriginalInExternal`, `crates/engine/src/cmd/convert.rs`, `apps/lightcraft/src/editors.rs` | an `-Edit` copy of each selected photo (up to 50 at once, issue #920) with the edits (PSD or TIFF, 16- or 8-bit, Adobe RGB / ProPhoto / P3 / sRGB, chosen per editor in Settings ▸ General ▸ External Editing) next to the original, added stacked on top of it and opened in PhotoCraft (found where its installers put it; a PSD by default, which PhotoCraft saves back to in place) or the other editor set there (or the system default); also on the photo's right-click menu (Edit In). Re-read when LightCraft is focused again. Open Original in Other Editor (RAW, no copy) hands that editor each selected photo's original file itself instead (a raw stays a raw, e.g. for DxO PhotoLab: no render, no copy, nothing added; several photos go to one start of the editor, which DxO PhotoLab 8 needs to get them all; demo photos, missing files and originals that are not a file type LightCraft reads are skipped with the reason, so a path an imported catalog named cannot hand a program to the system opener, issue #2135). Imported PSD/PSB photos retain embedded capture dates; PSD edit copies retain EXIF/XMP fields in the catalog and All Metadata. Original with Remove Location Info is refused when embedded PSD/PSB GPS is detected. No "Edit a copy / Edit original" choice for non-raw files yet |
## T. Share (SHARE)
@@@ -799,12 -799,9 +799,13 @@@ Latin stays upright. Advanced Japanese
| Date | Change | Summary |
|---|---|---|
+| 2026-10-25 | patch | LR-BEHAV-TITLEBAR: the top bar's title-bar gestures come from craft-window's `title_bar`: a double-click follows the system setting, and a press on a button, the search field or a panel floating over the bar never moves the window; status counts unchanged |
+| 2026-10-24 | minor | KEYC-METADATA, LRC-LIB-KEYWORDS: ⌥0 / ⌥⇧0 (`keyword.nextSet`, `keyword.previousSet`) go to the next / previous keyword set; status counts unchanged (KEYC-METADATA stays 🟡) |
+| 2026-10-24 | minor | KEYC-METADATA: ⌘K / Ctrl+K (`panel.addKeywords`, Add Keywords) shows the Keywords panel, opens Keywording and puts the cursor in the Add keyword box; status counts unchanged (KEYC-METADATA stays 🟡) |
+ | 2026-10-24 | patch | LR-EXP-METADATA: Original export refuses embedded GPS or nonblank place names when Remove Location Info is on; status and feature counts unchanged |
| 2026-10-24 | patch | LR-LIB-RATING, LR-LIB-DELETE: a slider drag still open when a rating, flag or label takes the photo out of the view, or when the photo is deleted, ends as its own undo step before the selection moves on, as moving to the next photo does; LR-BEHAV-LOCALIZE lists all 18 languages; status unchanged |
| 2026-10-24 | patch | Integration batch 43: Integrated main 98702b5c, preserving the new fail-closed GPS metadata check for Original export. Watermark geometry/orientation and HDR JPEG size-limit fixes remain in their shared helpers; no feature-count changes. |
+| 2026-10-23 | patch | LR-MERGE-HDR / LR-MERGE-PANO / LR-MERGE-HDRPANO: the merge dialog makes a new preview each time it opens, also after a failed one (#2708); status unchanged |
| 2026-10-23 | patch | Export integration: Integrated main 5ca49b3e, retaining Width & Height resizing, export format/bit-depth validation and batch panic cancellation alongside the existing watermark and HDR JPEG size-limit fixes. No feature-count changes. |
| 2026-10-23 | minor | LRC-LIB-CATALOG-SWITCH, LR-PREF-GENERAL: Settings ▸ General ▸ At launch (Open the last library / Ask me) with a launch window listing the recent libraries, Alt/Option at launch asks once, File ▸ Open Recent Library ▸ Remove from List and `app.recentLibraries {remove}` (issue #1290); photos dropped while no library is open wait for the one opened (presets are refused then); status and counts unchanged (✅) |
| 2026-10-23 | minor | LRC-LIB-CATALOG-IMPORT: Import Lightroom Catalog… (and Open Library's offer for a Lightroom catalog) asks whether the catalog merges into the open library or goes into a new library made next to it; Settings ▸ General or "Don't ask again" switches the question off; `file.importLightroom` takes `into` / `name` / `location` (#2672); status unchanged (🟡) |
diff --cc docs/whats-new.md
index 06975988e,52ae9a2b8..5a6acce38
--- a/docs/whats-new.md
+++ b/docs/whats-new.md
@@@ -1,18 -1,10 +1,21 @@@
# What's new in LightCraft
+## 2026-10-27
+
+### The Edit menu groups Select Only Active Photo and Paste Settings from Previous with their kin
+- Select Only Active Photo now sits under Deselect All, and Paste Settings from Previous under Paste Selected Settings…, instead of both after Settings…, near the end of the Edit menu. On macOS, where Settings… lives in the application menu, the Edit menu no longer shows two separator lines in a row.
+
+## 2026-10-25
+
+### `>=` and `<=` work in the search box
+- Fielded search tokens now take inclusive comparisons: `rating:>=3`, `iso:<=400`, `f:>=2.8`, `focal:<=50`. Before,
+ the `=` was read as part of the number, so such a search quietly showed no photos at all.
+
## 2026-10-24
+ ### Original export checks embedded place names when removing location
+ - Original copies are refused when “Remove Location Info” is enabled and the source contains GPS or a nonblank sublocation, city, state or country. Use JPEG or TIFF for rendered output; DNG is available for raw photos.
+
### Relative-date filters and smart albums follow the clock
- A current view or source count using “in the last” rules now refreshes when the session clock moves into a new
minute, even when no catalog edit occurred. This fixes stale photos remaining in the grid and stale counts for