Skip to content

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

Merge PR #712

Claudeb6ad706aa6d9
diff --cc crates/engine/src/export.rs
index ad1d7e560,315ceca64..975946d03
--- a/crates/engine/src/export.rs
+++ b/crates/engine/src/export.rs
@@@ -1581,21 -1502,22 +1586,28 @@@ impl PreparedExport
}
None => encode_rendered(&r, &opts, meta.as_ref())?,
};
- Ok(Exported { file_name, bytes, width: r.image.width, height: r.image.height, sidecars: Vec::new() })
+ Ok(Exported { file_name, bytes, width: r.image.width, height: r.image.height, sidecars: Vec::new(), gpu_fallback })
}
- Work::File { path, read, packet, dng, label, size } => {
+ Work::File { path, read, packet, dng, 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 && lightcraft_meta::extract(&bytes).gps.is_some() {
+ return Err(format!(
+ "{label}: can't remove the location from an original file that embeds GPS; export as JPEG, TIFF or DNG instead"
+ ));
+ }
- return Ok(Exported { file_name, bytes, width: size.0, height: size.1, sidecars: vec![("xmp", packet.into_bytes())] });
+ 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"));