Skip to content

PhotoCraft: An open-source, photo editor written by scratch in pure Rust

Camera Raw Filter: save and load settings as .xmp (#4279)

FredAppsccfc878a1484
diff --git a/crates/io/src/camera_raw_xmp.rs b/crates/io/src/camera_raw_xmp.rs
new file mode 100644
index 000000000..159e298a0
--- /dev/null
+++ b/crates/io/src/camera_raw_xmp.rs
@@ -0,0 +1,423 @@
+//! Camera Raw Filter › Save Settings… / Load Settings… (#4274): Adobe Camera Raw settings files
+//! (`.xmp`), the `crs:` namespace (`http://ns.adobe.com/camera-raw-settings/1.0/`) on an
+//! `x:xmpmeta/rdf:RDF/rdf:Description`, as attributes or as child elements.
+//!
+//! Loading applies only the settings the file holds, over the current ones, as Camera Raw's
+//! Load Settings does; settings PhotoCraft has no control for (lens corrections, calibration,
+//! geometry, defringe, …) are ignored and named in the report. Saving writes every supported
+//! control, so loading the file in Photoshop reproduces the dialog.
+//!
+//! White balance: a Camera Raw Filter on a rendered image uses the relative
+//! `IncrementalTemperature` / `IncrementalTint` (−100..=100), which are PhotoCraft's Temperature
+//! and Tint. The absolute `Temperature` (kelvin) / `Tint` of raw-file settings have no
+//! counterpart and are ignored.
+
+use photocraft_algo::camera_raw::{CameraRaw, validate_curve};
+
+/// The Camera Raw settings namespace.
+pub const CRS_NS: &str = "http://ns.adobe.com/camera-raw-settings/1.0/";
+const RDF_NS: &str = "http://www.w3.org/1999/02/22-rdf-syntax-ns#";
+/// Largest settings file read; real ones are a few kilobytes.
+pub const MAX_XMP_BYTES: usize = 4 * 1024 * 1024;
+
+type Field = fn(&mut CameraRaw) -> &mut f32;
+
+/// `crs:` scalar name, PhotoCraft field, and the slider range values are clamped to.
+const SCALARS: &[(&str, Field, f32, f32)] = &[
+ ("IncrementalTemperature", |p| &mut p.temperature, -100.0, 100.0),
+ ("IncrementalTint", |p| &mut p.tint, -100.0, 100.0),
+ ("Exposure2012", |p| &mut p.exposure, -5.0, 5.0),
+ ("Contrast2012", |p| &mut p.contrast, -100.0, 100.0),
+ ("Highlights2012", |p| &mut p.highlights, -100.0, 100.0),
+ ("Shadows2012", |p| &mut p.shadows, -100.0, 100.0),
+ ("Whites2012", |p| &mut p.whites, -100.0, 100.0),
+ ("Blacks2012", |p| &mut p.blacks, -100.0, 100.0),
+ ("Texture", |p| &mut p.texture, -100.0, 100.0),
+ ("Clarity2012", |p| &mut p.clarity, -100.0, 100.0),
+ ("Dehaze", |p| &mut p.dehaze, -100.0, 100.0),
+ ("Vibrance", |p| &mut p.vibrance, -100.0, 100.0),
+ ("Saturation", |p| &mut p.saturation, -100.0, 100.0),
+ ("ParametricShadows", |p| &mut p.curve_shadows, -100.0, 100.0),
+ ("ParametricDarks", |p| &mut p.curve_darks, -100.0, 100.0),
+ ("ParametricLights", |p| &mut p.curve_lights, -100.0, 100.0),
+ ("ParametricHighlights", |p| &mut p.curve_highlights, -100.0, 100.0),
+ ("ParametricShadowSplit", |p| &mut p.curve_splits[0], 0.0, 100.0),
+ ("ParametricMidtoneSplit", |p| &mut p.curve_splits[1], 0.0, 100.0),
+ ("ParametricHighlightSplit", |p| &mut p.curve_splits[2], 0.0, 100.0),
+ ("HueAdjustmentRed", |p| &mut p.hsl_hue[0], -100.0, 100.0),
+ ("HueAdjustmentOrange", |p| &mut p.hsl_hue[1], -100.0, 100.0),
+ ("HueAdjustmentYellow", |p| &mut p.hsl_hue[2], -100.0, 100.0),
+ ("HueAdjustmentGreen", |p| &mut p.hsl_hue[3], -100.0, 100.0),
+ ("HueAdjustmentAqua", |p| &mut p.hsl_hue[4], -100.0, 100.0),
+ ("HueAdjustmentBlue", |p| &mut p.hsl_hue[5], -100.0, 100.0),
+ ("HueAdjustmentPurple", |p| &mut p.hsl_hue[6], -100.0, 100.0),
+ ("HueAdjustmentMagenta", |p| &mut p.hsl_hue[7], -100.0, 100.0),
+ ("SaturationAdjustmentRed", |p| &mut p.hsl_sat[0], -100.0, 100.0),
+ ("SaturationAdjustmentOrange", |p| &mut p.hsl_sat[1], -100.0, 100.0),
+ ("SaturationAdjustmentYellow", |p| &mut p.hsl_sat[2], -100.0, 100.0),
+ ("SaturationAdjustmentGreen", |p| &mut p.hsl_sat[3], -100.0, 100.0),
+ ("SaturationAdjustmentAqua", |p| &mut p.hsl_sat[4], -100.0, 100.0),
+ ("SaturationAdjustmentBlue", |p| &mut p.hsl_sat[5], -100.0, 100.0),
+ ("SaturationAdjustmentPurple", |p| &mut p.hsl_sat[6], -100.0, 100.0),
+ ("SaturationAdjustmentMagenta", |p| &mut p.hsl_sat[7], -100.0, 100.0),
+ ("LuminanceAdjustmentRed", |p| &mut p.hsl_lum[0], -100.0, 100.0),
+ ("LuminanceAdjustmentOrange", |p| &mut p.hsl_lum[1], -100.0, 100.0),
+ ("LuminanceAdjustmentYellow", |p| &mut p.hsl_lum[2], -100.0, 100.0),
+ ("LuminanceAdjustmentGreen", |p| &mut p.hsl_lum[3], -100.0, 100.0),
+ ("LuminanceAdjustmentAqua", |p| &mut p.hsl_lum[4], -100.0, 100.0),
+ ("LuminanceAdjustmentBlue", |p| &mut p.hsl_lum[5], -100.0, 100.0),
+ ("LuminanceAdjustmentPurple", |p| &mut p.hsl_lum[6], -100.0, 100.0),
+ ("LuminanceAdjustmentMagenta", |p| &mut p.hsl_lum[7], -100.0, 100.0),
+ // Color Grading keeps the split-toning names for the shadow and highlight wheels' hue and
+ // saturation, and the balance.
+ ("SplitToningShadowHue", |p| &mut p.grade_shadows.hue, 0.0, 360.0),
+ ("SplitToningShadowSaturation", |p| &mut p.grade_shadows.sat, 0.0, 100.0),
+ ("ColorGradeShadowLum", |p| &mut p.grade_shadows.lum, -100.0, 100.0),
+ ("ColorGradeMidtoneHue", |p| &mut p.grade_midtones.hue, 0.0, 360.0),
+ ("ColorGradeMidtoneSat", |p| &mut p.grade_midtones.sat, 0.0, 100.0),
+ ("ColorGradeMidtoneLum", |p| &mut p.grade_midtones.lum, -100.0, 100.0),
+ ("SplitToningHighlightHue", |p| &mut p.grade_highlights.hue, 0.0, 360.0),
+ ("SplitToningHighlightSaturation", |p| &mut p.grade_highlights.sat, 0.0, 100.0),
+ ("ColorGradeHighlightLum", |p| &mut p.grade_highlights.lum, -100.0, 100.0),
+ ("ColorGradeGlobalHue", |p| &mut p.grade_global.hue, 0.0, 360.0),
+ ("ColorGradeGlobalSat", |p| &mut p.grade_global.sat, 0.0, 100.0),
+ ("ColorGradeGlobalLum", |p| &mut p.grade_global.lum, -100.0, 100.0),
+ ("ColorGradeBlending", |p| &mut p.grade_blending, 0.0, 100.0),
+ ("SplitToningBalance", |p| &mut p.grade_balance, -100.0, 100.0),
+ ("Sharpness", |p| &mut p.sharpen_amount, 0.0, 150.0),
+ ("SharpenRadius", |p| &mut p.sharpen_radius, 0.5, 3.0),
+ ("SharpenDetail", |p| &mut p.sharpen_detail, 0.0, 100.0),
+ ("SharpenEdgeMasking", |p| &mut p.sharpen_masking, 0.0, 100.0),
+ ("LuminanceSmoothing", |p| &mut p.noise_luminance, 0.0, 100.0),
+ ("LuminanceNoiseReductionDetail", |p| &mut p.noise_luminance_detail, 0.0, 100.0),
+ ("ColorNoiseReduction", |p| &mut p.noise_color, 0.0, 100.0),
+ ("ColorNoiseReductionDetail", |p| &mut p.noise_color_detail, 0.0, 100.0),
+ ("GrainAmount", |p| &mut p.grain_amount, 0.0, 100.0),
+ ("GrainSize", |p| &mut p.grain_size, 0.0, 100.0),
+ ("GrainFrequency", |p| &mut p.grain_roughness, 0.0, 100.0),
+ ("PostCropVignetteAmount", |p| &mut p.vignette_amount, -100.0, 100.0),
+ ("PostCropVignetteMidpoint", |p| &mut p.vignette_midpoint, 0.0, 100.0),
+ ("PostCropVignetteRoundness", |p| &mut p.vignette_roundness, -100.0, 100.0),
+ ("PostCropVignetteFeather", |p| &mut p.vignette_feather, 0.0, 100.0),
+ ("PostCropVignetteHighlightContrast", |p| &mut p.vignette_highlights, 0.0, 100.0),
+];
+
+type Curve = fn(&mut CameraRaw) -> &mut Vec<[f32; 2]>;
+const CURVES: &[(&str, Curve)] = &[
+ ("ToneCurvePV2012", |p| &mut p.point_curve),
+ ("ToneCurvePV2012Red", |p| &mut p.point_curve_red),
+ ("ToneCurvePV2012Green", |p| &mut p.point_curve_green),
+ ("ToneCurvePV2012Blue", |p| &mut p.point_curve_blue),
+];
+
+const STYLES: &[(&str, &str)] = &[("1", "highlightPriority"), ("2", "colorPriority"), ("3", "paintOverlay")];
+
+/// Bookkeeping fields Camera Raw writes that carry no setting.
+const METADATA: &[&str] = &[
+ "Version",
+ "ProcessVersion",
+ "HasSettings",
+ "HasCrop",
+ "WhiteBalance",
+ "ToneCurveName2012",
+ "CameraProfile",
+ "PresetType",
+ "UUID",
+ "SupportsAmount",
+ "SupportsColor",
+ "SupportsMonochrome",
+ "SupportsHighDynamicRange",
+ "SupportsNormalDynamicRange",
+ "SupportsSceneReferred",
+ "SupportsOutputReferred",
+ "CameraModelRestriction",
+ "Copyright",
+ "ContactInfo",
+ "Name",
+ "ShortName",
+ "SortName",
+ "Group",
+ "Description",
+];
+
+/// What [`load`] applied.
+#[derive(Clone, Debug, Default, PartialEq)]
+pub struct LoadReport {
+ /// How many settings were applied.
+ pub applied: usize,
+ /// `crs:` settings without a PhotoCraft control (set to something other than their neutral
+ /// value), or with an unusable value, in file order.
+ pub ignored: Vec<String>,
+}
+
+fn number(s: &str) -> Option<f32> {
+ let s = s.trim();
+ let v: f32 = s.strip_prefix('+').unwrap_or(s).parse().ok()?;
+ v.is_finite().then_some(v)
+}
+
+/// `"0, 0"` items of an `rdf:Seq` → curve points.
+fn curve(node: roxmltree::Node<'_, '_>) -> Option<Vec<[f32; 2]>> {
+ let seq = node.children().find(|c| c.is_element() && c.tag_name().namespace() == Some(RDF_NS) && c.tag_name().name() == "Seq")?;
+ let mut points = Vec::new();
+ for li in seq.children().filter(|c| c.is_element() && c.tag_name().name() == "li") {
+ let text = li.text().unwrap_or("");
+ let (x, y) = text.split_once(',')?;
+ points.push([number(x)?, number(y)?]);
+ }
+ validate_curve(&points).ok()?;
+ // Camera Raw's linear curve is the identity's two end points; PhotoCraft's is empty.
+ if points == [[0.0, 0.0], [255.0, 255.0]] {
+ points.clear();
+ }
+ Some(points)
+}
+
+/// An unsupported setting at its neutral value changes nothing, so it isn't reported: zero,
+/// `False`, and the few neutral values that aren't zero.
+fn neutral(name: &str, value: &str) -> bool {
+ let v = value.trim();
+ if v.eq_ignore_ascii_case("false") || number(v) == Some(0.0) {
+ return true;
+ }
+ match name {
+ "GrainSeed" => true,
+ "VignetteMidpoint" => number(v) == Some(50.0),
+ "PerspectiveScale" => number(v) == Some(100.0),
+ _ => name.starts_with("Defringe") && name.contains("Hue"),
+ }
+}
+
+fn apply(params: &mut CameraRaw, report: &mut LoadReport, name: &str, value: &str) {
+ if let Some((_, field, lo, hi)) = SCALARS.iter().find(|(n, ..)| *n == name) {
+ match number(value) {
+ Some(v) => {
+ *field(params) = v.clamp(*lo, *hi);
+ report.applied += 1;
+ }
+ None => report.ignored.push(name.to_string()),
+ }
+ } else if name == "PostCropVignetteStyle" {
+ match STYLES.iter().find(|(n, _)| *n == value.trim()) {
+ Some((_, style)) => {
+ params.vignette_style = (*style).into();
+ report.applied += 1;
+ }
+ None => report.ignored.push(name.to_string()),
+ }
+ } else if !METADATA.contains(&name) && !neutral(name, value) {
+ report.ignored.push(name.to_string());
+ }
+}
+
+/// Apply a Camera Raw settings file over `params`. Fails on input that isn't XMP or holds no
+/// Camera Raw settings; never panics on malformed input.
+pub fn load(params: &mut CameraRaw, bytes: &[u8]) -> Result<LoadReport, String> {
+ if bytes.len() > MAX_XMP_BYTES {
+ return Err("the settings file is too large".into());
+ }
+ let text = std::str::from_utf8(bytes).map_err(|_| "not a Camera Raw settings file (not UTF-8 text)".to_string())?;
+ // Some writers put a byte order mark or an `<?xpacket?>` wrapper first; roxmltree takes both.
+ let text = text.trim_start_matches('\u{feff}');
+ let doc = roxmltree::Document::parse(text).map_err(|e| format!("not a Camera Raw settings file ({e})"))?;
+ let mut next = params.clone();
+ let mut report = LoadReport::default();
+ let mut found = false;
+ for desc in doc.descendants().filter(|n| n.is_element() && n.tag_name().namespace() == Some(RDF_NS) && n.tag_name().name() == "Description") {
+ for a in desc.attributes().filter(|a| a.namespace() == Some(CRS_NS)) {
+ found = true;
+ apply(&mut next, &mut report, a.name(), a.value());
+ }
+ for c in desc.children().filter(|c| c.is_element() && c.tag_name().namespace() == Some(CRS_NS)) {
+ found = true;
+ let name = c.tag_name().name();
+ if let Some((_, field)) = CURVES.iter().find(|(n, _)| *n == name) {
+ match curve(c) {
+ Some(points) => {
+ *field(&mut next) = points;
+ report.applied += 1;
+ }
+ None => report.ignored.push(name.to_string()),
+ }
+ } else if c.children().any(|g| g.is_element()) {
+ // Structured settings (masks, looks, lens profiles…) have no counterpart.
+ if !METADATA.contains(&name) {
+ report.ignored.push(name.to_string());
+ }
+ } else {
+ apply(&mut next, &mut report, name, c.text().unwrap_or(""));
+ }
+ }
+ }
+ if !found {
+ return Err("no Camera Raw settings in the file".into());
+ }
+ *params = next;
+ Ok(report)
+}
+
+fn signed(v: f32, decimals: usize) -> String {
+ let s = format!("{v:.decimals$}");
+ if v > 0.0 && !s.starts_with('+') { format!("+{s}") } else { s }
+}
+
+fn escape(s: &str) -> String {
+ s.replace('&', "&amp;").replace('<', "&lt;").replace('>', "&gt;").replace('"', "&quot;")
+}
+
+/// Write `params` as a Camera Raw settings file Photoshop's Load Settings… reads.
+pub fn save(params: &CameraRaw) -> String {
+ let mut p = params.clone();
+ let wb = if p.temperature != 0.0 || p.tint != 0.0 { "Custom" } else { "As Shot" };
+ let mut out = String::from(
+ "<x:xmpmeta xmlns:x=\"adobe:ns:meta/\" x:xmptk=\"PhotoCraft\">\n <rdf:RDF xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">\n <rdf:Description rdf:about=\"\"\n xmlns:crs=\"http://ns.adobe.com/camera-raw-settings/1.0/\"\n",
+ );
+ out.push_str(" crs:Version=\"18.4\"\n crs:ProcessVersion=\"15.4\"\n");
+ out.push_str(&format!(" crs:WhiteBalance=\"{wb}\"\n"));
+ for (name, field, lo, _) in SCALARS {
+ let v = *field(&mut p);
+ // Exposure has two decimals in Camera Raw, the sharpening radius one; the rest are levels.
+ let text = match *name {
+ "Exposure2012" => signed(v, 2),
+ "SharpenRadius" => signed(v, 1),
+ _ if *lo < 0.0 => signed(v.round(), 0),
+ _ => format!("{:.0}", v.round()),
+ };
+ out.push_str(&format!(" crs:{name}=\"{text}\"\n"));
+ }
+ let style = STYLES.iter().find(|(_, s)| *s == p.vignette_style).map_or("1", |(n, _)| n);
+ out.push_str(&format!(" crs:PostCropVignetteStyle=\"{}\"\n", escape(style)));
+ out.push_str(" crs:ToneCurveName2012=\"Custom\"\n crs:HasSettings=\"True\">\n");
+ for (name, field) in CURVES {
+ let points = field(&mut p);
+ let points = if points.is_empty() { vec![[0.0, 0.0], [255.0, 255.0]] } else { points.clone() };
+ out.push_str(&format!(" <crs:{name}>\n <rdf:Seq>\n"));
+ for [x, y] in points {
+ out.push_str(&format!(" <rdf:li>{}, {}</rdf:li>\n", x.round(), y.round()));
+ }
+ out.push_str(&format!(" </rdf:Seq>\n </crs:{name}>\n"));
+ }
+ out.push_str(" </rdf:Description>\n </rdf:RDF>\n</x:xmpmeta>\n");
+ out
+}
+
+#[cfg(test)]
+#[allow(clippy::unwrap_used)]
+mod tests {
+ use super::*;
+
+ /// A hand-written settings file laid out as Photoshop 26's Camera Raw Filter saves one (the
+ /// field set and order follow Camera Raw 18; the values are synthetic), plus element-form
+ /// settings, which XMP allows and some writers use.
+ const FIXTURE: &[u8] = br#"<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="Adobe XMP Core 7.0-c000 1.000000, 0000/00/00-00:00:00 ">
+ <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
+ <rdf:Description rdf:about=""
+ xmlns:crs="http://ns.adobe.com/camera-raw-settings/1.0/"
+ crs:Version="18.1.1" crs:ProcessVersion="15.4" crs:WhiteBalance="Custom"
+ crs:IncrementalTemperature="0" crs:IncrementalTint="+10" crs:Exposure2012="+0.05"
+ crs:Contrast2012="-5" crs:Highlights2012="-20" crs:Shadows2012="+10" crs:Whites2012="+35"
+ crs:Blacks2012="0" crs:Texture="+30" crs:Clarity2012="+5" crs:Vibrance="+20" crs:Saturation="-5"
+ crs:ParametricShadowSplit="25" crs:ParametricMidtoneSplit="50" crs:ParametricHighlightSplit="75"
+ crs:Sharpness="15" crs:SharpenRadius="+1.0" crs:LuminanceSmoothing="5"
+ crs:LuminanceNoiseReductionContrast="0" crs:HueAdjustmentGreen="+25" crs:SaturationAdjustmentGreen="+20"
+ crs:ColorGradeBlending="50" crs:LensProfileEnable="0" crs:VignetteAmount="-20"
+ crs:PerspectiveScale="100" crs:GrainAmount="10" crs:RedHue="-5" crs:GrainSeed="2834497962"
+ crs:ToneCurveName2012="Linear" crs:CameraProfile="Default Color" crs:HasSettings="True" crs:HasCrop="False">
+ <crs:Dehaze>+12</crs:Dehaze>
+ <crs:ToneCurvePV2012>
+ <rdf:Seq>
+ <rdf:li>0, 0</rdf:li>
+ <rdf:li>255, 255</rdf:li>
+ </rdf:Seq>
+ </crs:ToneCurvePV2012>
+ <crs:ToneCurvePV2012Red>
+ <rdf:Seq>
+ <rdf:li>0, 0</rdf:li>
+ <rdf:li>128, 140</rdf:li>
+ <rdf:li>255, 255</rdf:li>
+ </rdf:Seq>
+ </crs:ToneCurvePV2012Red>
+ </rdf:Description>
+ </rdf:RDF>
+</x:xmpmeta>"#;
+
+ #[test]
+ fn reads_a_photoshop_preset() {
+ let mut p = CameraRaw::default();
+ let r = load(&mut p, FIXTURE).unwrap();
+ assert_eq!(p.tint, 10.0);
+ assert_eq!(p.exposure, 0.05);
+ assert_eq!((p.contrast, p.highlights, p.shadows, p.whites), (-5.0, -20.0, 10.0, 35.0));
+ assert_eq!((p.texture, p.clarity, p.vibrance, p.saturation), (30.0, 5.0, 20.0, -5.0));
+ assert_eq!((p.hsl_hue[3], p.hsl_sat[3]), (25.0, 20.0));
+ assert_eq!((p.sharpen_amount, p.noise_luminance, p.grain_amount), (15.0, 5.0, 10.0));
+ assert_eq!(p.grade_blending, 50.0);
+ // The linear tone curve is PhotoCraft's empty one; an element-form setting is read too.
+ assert!(p.point_curve.is_empty());
+ assert_eq!(p.point_curve_red, vec![[0.0, 0.0], [128.0, 140.0], [255.0, 255.0]]);
+ assert_eq!(p.dehaze, 12.0);
+ // Lens vignetting, calibration and geometry have no counterpart.
+ assert_eq!(r.ignored, vec!["VignetteAmount".to_string(), "RedHue".to_string()]);
+ }
+
+ #[test]
+ fn save_then_load_round_trips() {
+ let mut p = CameraRaw {
+ temperature: -12.0,
+ exposure: 1.25,
+ contrast: 30.0,
+ sharpen_radius: 1.4,
+ vignette_amount: -40.0,
+ vignette_style: "paintOverlay".into(),
+ curve_splits: [20.0, 45.0, 80.0],
+ point_curve: vec![[0.0, 10.0], [128.0, 150.0], [255.0, 240.0]],
+ ..CameraRaw::default()
+ };
+ p.hsl_lum[5] = -33.0;
+ p.grade_shadows.hue = 210.0;
+ p.grade_shadows.sat = 40.0;
+ p.grade_global.lum = 7.0;
+ let text = save(&p);
+ assert!(text.contains("crs:Exposure2012=\"+1.25\""));
+ assert!(text.contains("crs:WhiteBalance=\"Custom\""));
+ let mut back = CameraRaw::default();
+ let r = load(&mut back, text.as_bytes()).unwrap();
+ assert!(r.ignored.is_empty(), "{:?}", r.ignored);
+ assert_eq!(back, p);
+ }
+
+ #[test]
+ fn load_applies_only_the_settings_in_the_file() {
+ let mut p = CameraRaw { contrast: 40.0, ..CameraRaw::default() };
+ let xmp = br#"<x:xmpmeta xmlns:x="adobe:ns:meta/"><rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
+ <rdf:Description xmlns:crs="http://ns.adobe.com/camera-raw-settings/1.0/"><crs:Exposure2012>-9</crs:Exposure2012>
+ <crs:Clarity2012>abc</crs:Clarity2012></rdf:Description></rdf:RDF></x:xmpmeta>"#;
+ let r = load(&mut p, xmp).unwrap();
+ assert_eq!((p.exposure, p.contrast, p.clarity), (-5.0, 40.0, 0.0));
+ assert_eq!(r, LoadReport { applied: 1, ignored: vec!["Clarity2012".into()] });
+ }
+
+ #[test]
+ fn malformed_input_is_an_error_and_leaves_settings_alone() {
+ let before = CameraRaw { exposure: 0.5, ..CameraRaw::default() };
+ for bad in [
+ &b""[..],
+ b"\xff\xfe\x00garbage",
+ b"<x:xmpmeta><unclosed",
+ b"<x:xmpmeta xmlns:x=\"adobe:ns:meta/\"/>",
+ b"<?xml version=\"1.0\"?><!DOCTYPE a [<!ENTITY e \"x\">]><a>&e;</a>",
+ ] {
+ let mut p = before.clone();
+ assert!(load(&mut p, bad).is_err());
+ assert_eq!(p, before);
+ }
+ // A broken curve or NaN is skipped, not fatal.
+ let xmp = br#"<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"><rdf:Description
+ xmlns:crs="http://ns.adobe.com/camera-raw-settings/1.0/" crs:Contrast2012="NaN"><crs:ToneCurvePV2012><rdf:Seq>
+ <rdf:li>10</rdf:li></rdf:Seq></crs:ToneCurvePV2012></rdf:Description></rdf:RDF>"#;
+ let mut p = before.clone();
+ let r = load(&mut p, xmp).unwrap();
+ assert_eq!(p, before);
+ assert_eq!(r.ignored, vec!["Contrast2012".to_string(), "ToneCurvePV2012".to_string()]);
+ }
+}
diff --git a/crates/io/src/lib.rs b/crates/io/src/lib.rs
index 9852a4851..b6120eb08 100644
--- a/crates/io/src/lib.rs
+++ b/crates/io/src/lib.rs
@@ -36,6 +36,7 @@ mod adjust_map;
pub mod affinity;
pub mod annotations_map;
pub mod blocks;
+pub mod camera_raw_xmp;
mod channel_map;
pub mod comps_map;
pub mod effects_map;
diff --git a/crates/ui-egui/src/camera_raw_ui.rs b/crates/ui-egui/src/camera_raw_ui.rs
index c939714d9..80ce77f4b 100644
--- a/crates/ui-egui/src/camera_raw_ui.rs
+++ b/crates/ui-egui/src/camera_raw_ui.rs
@@ -7,7 +7,9 @@
//! one history step (or a smart filter on a smart object) and exactly replayable.
//!
//! Control channel: `ui.menu.invoke {"id":"filter.cameraRaw","params":{"ui":{"set":{…},
-//! "commit":true | "cancel":true}}}`; the reply describes the dialog.
+//! "commit":true | "cancel":true}}}`; the reply describes the dialog. `{"ui":{"saveSettings":true}}`
+//! and `{"ui":{"loadSettings":true}}` run Save Settings… / Load Settings… (Camera Raw `.xmp`
+//! settings files, see [`photocraft_io::camera_raw_xmp`]) through the file dialog.
use egui::{Align2, Color32, FontId, Pos2, Rect as ERect, Sense, Stroke, TextureHandle, pos2, vec2};
use photocraft_algo::camera_raw::{CameraRaw, Wheel, curve_lut};
@@ -669,14 +671,22 @@ pub fn menu(app: &mut PhotocraftApp, ctx: &egui::Context, id: &str, params: &Val
for (key, value) in fields {
match key.as_str() {
"set" | "scope" | "view" => {}
- "before" | "commit" | "cancel" if value.is_boolean() => {}
- "before" | "commit" | "cancel" => return Some(Err(format!("Camera Raw {key} must be a boolean"))),
+ "before" | "commit" | "cancel" | "saveSettings" | "loadSettings" if value.is_boolean() => {}
+ "before" | "commit" | "cancel" | "saveSettings" | "loadSettings" => return Some(Err(format!("Camera Raw {key} must be a boolean"))),
_ => return Some(Err(format!("unknown Camera Raw ui property {key}"))),
}
}
if ui.get("commit").and_then(Value::as_bool) == Some(true) && ui.get("cancel").and_then(Value::as_bool) == Some(true) {
return Some(Err("Camera Raw cannot commit and cancel together".into()));
}
+ for (key, run) in [("saveSettings", save_settings as fn(&mut PhotocraftApp) -> Result<Value, String>), ("loadSettings", load_settings)] {
+ if ui.get(key).and_then(Value::as_bool) == Some(true) {
+ if fields.len() > 1 {
+ return Some(Err(format!("Camera Raw {key} must be sent on its own")));
+ }
+ return Some(run(app));
+ }
+ }
let was_closed = app.camera_raw.is_none();
let previous_view = app.ui.camera_raw_scope.clone();
let previous_navigation = app.ui.camera_raw_preview;
@@ -766,6 +776,52 @@ fn menu_update(app: &mut PhotocraftApp, ctx: &egui::Context, ui: &Value) -> Opti
Some(Ok(app.camera_raw.as_ref().map(|d| d.describe(&app.ui.camera_raw_scope, &app.ui.camera_raw_preview)).unwrap_or(Value::Null)))
}
+/// Save Settings…: the dialog's settings as a Camera Raw `.xmp` settings file.
+fn save_settings(app: &mut PhotocraftApp) -> Result<Value, String> {
+ let d = app.camera_raw.as_ref().ok_or(tl!("Camera Raw isn't open"))?;
+ let bytes = photocraft_io::camera_raw_xmp::save(&d.params).into_bytes();
+ app.pick_save("Camera Raw Settings.xmp", move |app, path| {
+ let write = app.services.write.as_mut().ok_or("no writer configured")?;
+ write(&path, &bytes)?;
+ Ok(json!({"path": path}))
+ })
+}
+
+/// Load Settings…: applies a Camera Raw `.xmp` settings file's supported settings over the
+/// dialog's; the status bar names how many were not supported.
+fn load_settings(app: &mut PhotocraftApp) -> Result<Value, String> {
+ app.camera_raw.as_ref().ok_or(tl!("Camera Raw isn't open"))?;
+ app.pick_file_bytes_filtered(&["xmp"], |app, name, bytes| {
+ let file = crate::file_open::display_name(&name);
+ let d = app.camera_raw.as_mut().ok_or(tl!("Camera Raw isn't open"))?;
+ let mut next = d.params.clone();
+ let report = photocraft_io::camera_raw_xmp::load(&mut next, &bytes).map_err(|e| format!("{file}: {e}"))?;
+ next.validate_changes(&d.original).map_err(|e| format!("{file}: {e}"))?;
+ if d.params.point_curve != next.point_curve {
+ d.curve_state = Default::default();
+ }
+ d.dirty |= d.params != next;
+ d.params = next;
+ app.ui.status_error = false;
+ app.ui.status = if report.ignored.is_empty() {
+ crate::i18n::fmt(tl!("Loaded Camera Raw settings from {file}"), &[("file", &file)])
+ } else {
+ let template = "Loaded Camera Raw settings from {file} ({n} not supported)";
+ crate::i18n::fmt(tl!(template), &[("file", &file), ("n", &report.ignored.len().to_string())])
+ };
+ Ok(json!({"applied": report.applied, "ignored": report.ignored}))
+ })
+}
+
+fn report_file_error(app: &mut PhotocraftApp, r: Result<Value, String>) {
+ if let Err(e) = r
+ && e != crate::file_dialog::CANCELLED
+ {
+ app.ui.status_error = true;
+ app.ui.status = e;
+ }
+}
+
fn commit(app: &mut PhotocraftApp) -> Result<Value, String> {
let d = app.camera_raw.as_ref().ok_or(tl!("Camera Raw isn't open"))?;
let result = match d.target {
@@ -1133,6 +1189,13 @@ fn draw(app: &mut PhotocraftApp, ctx: &egui::Context, own_window: bool) {
fu.add_space(12.0);
widgets::checkbox(&mut fu, &mut d.show_before, tl!("Before (Y)"));
fu.label(egui::RichText::new(format!("{:.0} ms", d.render_ms)).color(t.text_faint));
+ fu.add_space(12.0);
+ if fu.button(tl!("Save Settings…")).on_hover_text(tl!("Save these settings as a Camera Raw .xmp file")).clicked() {
+ action = Some("save");
+ }
+ if fu.button(tl!("Load Settings…")).on_hover_text(tl!("Load settings from a Camera Raw .xmp file")).clicked() {
+ action = Some("load");
+ }
});
super::camera_raw_scope_ui::persist(app, ctx);
if ctx.input(|i| i.key_pressed(egui::Key::Y))
@@ -1150,6 +1213,14 @@ fn draw(app: &mut PhotocraftApp, ctx: &egui::Context, own_window: bool) {
}
}
Some("cancel") => cancel(app),
+ Some("save") => {
+ let r = save_settings(app);
+ report_file_error(app, r);
+ }
+ Some("load") => {
+ let r = load_settings(app);
+ report_file_error(app, r);
+ }
_ => {}
}
}
@@ -1479,4 +1550,68 @@ mod tests {
// A non-raw never queues the dialog; a closed document is an error, not a panic.
assert!(open_raw(&mut app, &ctx, RawOpen { document: photocraft_doc::DocId(u64::MAX), name: "x".into(), path: None, bytes: None }).is_err());
}
+
+ #[test]
+ fn save_and_load_settings_round_trip_through_xmp_files() {
+ use crate::file_dialog::FileDialogAnswer;
+ use std::sync::{Arc, Mutex};
+ type Written = Arc<Mutex<Vec<(String, Vec<u8>)>>>;
+ let written: Written = Arc::default();
+ let w = written.clone();
+ let foreign = br#"<x:xmpmeta xmlns:x="adobe:ns:meta/"><rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
+ <rdf:Description xmlns:crs="http://ns.adobe.com/camera-raw-settings/1.0/" crs:Clarity2012="+25" crs:RedHue="-5"/>
+ </rdf:RDF></x:xmpmeta>"#;
+ let answers = vec![
+ Some(FileDialogAnswer::SaveTo("/out/Look.xmp".into())),
+ Some(FileDialogAnswer::Contents("Look.xmp".into(), Vec::new())),
+ Some(FileDialogAnswer::Contents("Other.xmp".into(), foreign.to_vec())),
+ Some(FileDialogAnswer::Contents("Broken.xmp".into(), b"<nope".to_vec())),
+ ];
+ let services = crate::Services {
+ file_dialog: Some(crate::file_dialog::fake(answers).0),
+ write: Some(Box::new(move |p: &str, b: &[u8]| {
+ w.lock().unwrap().push((p.to_string(), b.to_vec()));
+ Ok(())
+ })),
+ ..Default::default()
+ };
+ let mut app = PhotocraftApp::new(photocraft_engine::Session::new(), services);
+ let ctx = egui::Context::default();
+ let frame = |app: &mut PhotocraftApp| app.poll_file_dialog(&egui::Context::default(), None);
+ app.run("file.new", json!({"width": 16, "height": 16})).unwrap();
+ app.run("layer.new.layer", json!({})).unwrap();
+ app.run("edit.fill", json!({"color": "#808080"})).unwrap();
+ menu(&mut app, &ctx, "filter.cameraRaw", &json!({"ui": {"set": {"exposure": 0.75, "contrast": -20, "hslSat": [0, 0, 0, 30, 0, 0, 0, 0]}}}))
+ .unwrap()
+ .unwrap();
+ let saved_params = app.camera_raw.as_ref().unwrap().params.clone();
+ assert!(menu(&mut app, &ctx, "filter.cameraRaw", &json!({"ui": {"saveSettings": true, "before": true}})).unwrap().is_err());
+ assert_eq!(menu(&mut app, &ctx, "filter.cameraRaw", &json!({"ui": {"saveSettings": true}})).unwrap().unwrap()["fileDialog"], "save");
+ frame(&mut app);
+ let (path, bytes) = written.lock().unwrap()[0].clone();
+ assert_eq!(path, "/out/Look.xmp");
+ let text = String::from_utf8(bytes.clone()).unwrap();
+ assert!(text.contains("crs:Exposure2012=\"+0.75\"") && text.contains("crs:SaturationAdjustmentGreen=\"+30\""), "{text}");
+ // Reset, then load the saved file back (the fake dialog's second answer, with its bytes).
+ app.camera_raw.as_mut().unwrap().params = CameraRaw::default();
+ let mut svc = crate::file_dialog::fake(vec![Some(FileDialogAnswer::Contents("Look.xmp".into(), bytes))]).0;
+ std::mem::swap(app.services.file_dialog.as_mut().unwrap(), &mut svc);
+ menu(&mut app, &ctx, "filter.cameraRaw", &json!({"ui": {"loadSettings": true}})).unwrap().unwrap();
+ frame(&mut app);
+ assert_eq!(app.camera_raw.as_ref().unwrap().params, saved_params);
+ std::mem::swap(app.services.file_dialog.as_mut().unwrap(), &mut svc);
+ // The original service's next answer is the empty file: an error, settings untouched.
+ menu(&mut app, &ctx, "filter.cameraRaw", &json!({"ui": {"loadSettings": true}})).unwrap().unwrap();
+ frame(&mut app);
+ assert_eq!(app.camera_raw.as_ref().unwrap().params, saved_params);
+ // A foreign preset applies what it holds over the current settings and reports the rest.
+ menu(&mut app, &ctx, "filter.cameraRaw", &json!({"ui": {"loadSettings": true}})).unwrap().unwrap();
+ frame(&mut app);
+ let p = &app.camera_raw.as_ref().unwrap().params;
+ assert_eq!((p.clarity, p.exposure), (25.0, 0.75));
+ assert!(app.ui.status.contains("Other.xmp") && app.ui.status.contains('1'), "{}", app.ui.status);
+ menu(&mut app, &ctx, "filter.cameraRaw", &json!({"ui": {"loadSettings": true}})).unwrap().unwrap();
+ frame(&mut app);
+ assert_eq!(app.camera_raw.as_ref().unwrap().params.clarity, 25.0);
+ }
}
diff --git a/crates/ui-egui/src/i18n/cs.tsv b/crates/ui-egui/src/i18n/cs.tsv
index 16c1d9d2d..6b2c38cc8 100644
--- a/crates/ui-egui/src/i18n/cs.tsv
+++ b/crates/ui-egui/src/i18n/cs.tsv
@@ -860,6 +860,12 @@
Baseline shift Posun účaří
Basic Základní
Before (Y) Před (Y)
+ Save Settings… Uložit nastavení…
+ Load Settings… Načíst nastavení…
+ Save these settings as a Camera Raw .xmp file Uložit toto nastavení jako soubor Camera Raw .xmp
+ Load settings from a Camera Raw .xmp file Načíst nastavení ze souboru Camera Raw .xmp
+ Loaded Camera Raw settings from {file} Nastavení Camera Raw načteno ze souboru {file}
+ Loaded Camera Raw settings from {file} ({n} not supported) Nastavení Camera Raw načteno ze souboru {file} (nepodporováno: {n})
Begin recording Zahájit záznam
Bend: Ohyb:
Bicubic Bikubická
diff --git a/crates/ui-egui/src/i18n/de.tsv b/crates/ui-egui/src/i18n/de.tsv
index 25d19ff71..e86037b7f 100644
--- a/crates/ui-egui/src/i18n/de.tsv
+++ b/crates/ui-egui/src/i18n/de.tsv
@@ -837,6 +837,12 @@
Baseline shift Grundlinienverschiebung
Basic Grundeinstellungen
Before (Y) Davor (Y)
+ Save Settings… Einstellungen speichern…
+ Load Settings… Einstellungen laden…
+ Save these settings as a Camera Raw .xmp file Diese Einstellungen als Camera-Raw-.xmp-Datei speichern
+ Load settings from a Camera Raw .xmp file Einstellungen aus einer Camera-Raw-.xmp-Datei laden
+ Loaded Camera Raw settings from {file} Camera-Raw-Einstellungen aus {file} geladen
+ Loaded Camera Raw settings from {file} ({n} not supported) Camera-Raw-Einstellungen aus {file} geladen ({n} nicht unterstützt)
Begin recording Aufnahme starten
Bend: Biegung:
Bicubic Bikubisch
diff --git a/crates/ui-egui/src/i18n/el.tsv b/crates/ui-egui/src/i18n/el.tsv
index c840fbcb2..ffa683b6e 100644
--- a/crates/ui-egui/src/i18n/el.tsv
+++ b/crates/ui-egui/src/i18n/el.tsv
@@ -1899,6 +1899,12 @@
Aqua Κυανό
Balance Ισορροπία
Before (Y) Πριν (Y)
+ Save Settings… Αποθήκευση ρυθμίσεων…
+ Load Settings… Φόρτωση ρυθμίσεων…
+ Save these settings as a Camera Raw .xmp file Αποθήκευση αυτών των ρυθμίσεων ως αρχείο Camera Raw .xmp
+ Load settings from a Camera Raw .xmp file Φόρτωση ρυθμίσεων από αρχείο Camera Raw .xmp
+ Loaded Camera Raw settings from {file} Φορτώθηκαν ρυθμίσεις Camera Raw από το {file}
+ Loaded Camera Raw settings from {file} ({n} not supported) Φορτώθηκαν ρυθμίσεις Camera Raw από το {file} ({n} δεν υποστηρίζονται)
Blending Ανάμειξη
Camera Raw Filter ({layer}) Φίλτρο Camera Raw ({layer})
Camera Raw isn't open Το Camera Raw δεν είναι ανοιχτό
diff --git a/crates/ui-egui/src/i18n/es.tsv b/crates/ui-egui/src/i18n/es.tsv
index 71f4d655e..49b56d352 100644
--- a/crates/ui-egui/src/i18n/es.tsv
+++ b/crates/ui-egui/src/i18n/es.tsv
@@ -846,6 +846,12 @@
Baseline shift Desplazamiento de línea de base
Basic Básico
Before (Y) Antes (Y)
+ Save Settings… Guardar ajustes…
+ Load Settings… Cargar ajustes…
+ Save these settings as a Camera Raw .xmp file Guardar estos ajustes como archivo .xmp de Camera Raw
+ Load settings from a Camera Raw .xmp file Cargar ajustes desde un archivo .xmp de Camera Raw
+ Loaded Camera Raw settings from {file} Ajustes de Camera Raw cargados desde {file}
+ Loaded Camera Raw settings from {file} ({n} not supported) Ajustes de Camera Raw cargados desde {file} ({n} no compatibles)
Begin recording Iniciar grabación
Bend: Curvatura:
Bicubic Bicúbica
diff --git a/crates/ui-egui/src/i18n/fr.tsv b/crates/ui-egui/src/i18n/fr.tsv
index 7d9c50069..1e30b6a39 100644
--- a/crates/ui-egui/src/i18n/fr.tsv
+++ b/crates/ui-egui/src/i18n/fr.tsv
@@ -834,6 +834,12 @@
Baseline shift Décalage de la ligne de base
Basic De base
Before (Y) Avant (Y)
+ Save Settings… Enregistrer les paramètres…
+ Load Settings… Charger les paramètres…
+ Save these settings as a Camera Raw .xmp file Enregistrer ces paramètres dans un fichier .xmp Camera Raw
+ Load settings from a Camera Raw .xmp file Charger les paramètres d’un fichier .xmp Camera Raw
+ Loaded Camera Raw settings from {file} Paramètres Camera Raw chargés depuis {file}
+ Loaded Camera Raw settings from {file} ({n} not supported) Paramètres Camera Raw chargés depuis {file} ({n} non pris en charge)
Begin recording Démarrer l'enregistrement
Bend: Courbure :
Bicubic Bicubique
diff --git a/crates/ui-egui/src/i18n/hu.tsv b/crates/ui-egui/src/i18n/hu.tsv
index 56e203fde..c3a74e745 100644
--- a/crates/ui-egui/src/i18n/hu.tsv
+++ b/crates/ui-egui/src/i18n/hu.tsv
@@ -4002,3 +4002,9 @@ cameraRaw Yellow Sárga
Gradient Preset Options Színátmenet-előbeállítás beállításai
Import .GRD .GRD importálása
Choose a gradient file (.grd). Válasszon színátmenetfájlt (.grd).
+ Save Settings… Beállítások mentése…
+ Load Settings… Beállítások betöltése…
+ Save these settings as a Camera Raw .xmp file A beállítások mentése Camera Raw .xmp-fájlként
+ Load settings from a Camera Raw .xmp file Beállítások betöltése Camera Raw .xmp-fájlból
+ Loaded Camera Raw settings from {file} Camera Raw-beállítások betöltve innen: {file}
+ Loaded Camera Raw settings from {file} ({n} not supported) Camera Raw-beállítások betöltve innen: {file} ({n} nem támogatott)
diff --git a/crates/ui-egui/src/i18n/id.tsv b/crates/ui-egui/src/i18n/id.tsv
index 618687ff4..30fecce4c 100644
--- a/crates/ui-egui/src/i18n/id.tsv
+++ b/crates/ui-egui/src/i18n/id.tsv
@@ -828,6 +828,12 @@
Baseline shift Geser baseline
Basic Dasar
Before (Y) Sebelum (Y)
+ Save Settings… Simpan Pengaturan…
+ Load Settings… Muat Pengaturan…
+ Save these settings as a Camera Raw .xmp file Simpan pengaturan ini sebagai berkas .xmp Camera Raw
+ Load settings from a Camera Raw .xmp file Muat pengaturan dari berkas .xmp Camera Raw
+ Loaded Camera Raw settings from {file} Pengaturan Camera Raw dimuat dari {file}
+ Loaded Camera Raw settings from {file} ({n} not supported) Pengaturan Camera Raw dimuat dari {file} ({n} tidak didukung)
Begin recording Mulai merekam
Bend: Lengkung:
Bicubic Bicubic
diff --git a/crates/ui-egui/src/i18n/it.tsv b/crates/ui-egui/src/i18n/it.tsv
index 5aa105c5f..12a8c283e 100644
--- a/crates/ui-egui/src/i18n/it.tsv
+++ b/crates/ui-egui/src/i18n/it.tsv
@@ -844,6 +844,12 @@
Baseline shift Scostamento linea base
Basic Base
Before (Y) Prima (Y)
+ Save Settings… Salva impostazioni…
+ Load Settings… Carica impostazioni…
+ Save these settings as a Camera Raw .xmp file Salva queste impostazioni come file .xmp di Camera Raw
+ Load settings from a Camera Raw .xmp file Carica le impostazioni da un file .xmp di Camera Raw
+ Loaded Camera Raw settings from {file} Impostazioni Camera Raw caricate da {file}
+ Loaded Camera Raw settings from {file} ({n} not supported) Impostazioni Camera Raw caricate da {file} ({n} non supportate)
Begin recording Inizia registrazione
Bend: Curvatura:
Bicubic Bicubica
diff --git a/crates/ui-egui/src/i18n/ja.tsv b/crates/ui-egui/src/i18n/ja.tsv
index eebc97e3e..fafb869f8 100644
--- a/crates/ui-egui/src/i18n/ja.tsv
+++ b/crates/ui-egui/src/i18n/ja.tsv
@@ -847,6 +847,12 @@
Baseline shift ベースラインシフト
Basic 基本
Before (Y) 補正前(Y)
+ Save Settings… 設定を保存…
+ Load Settings… 設定を読み込み…
+ Save these settings as a Camera Raw .xmp file この設定を Camera Raw の .xmp ファイルとして保存
+ Load settings from a Camera Raw .xmp file Camera Raw の .xmp ファイルから設定を読み込む
+ Loaded Camera Raw settings from {file} {file} から Camera Raw の設定を読み込みました
+ Loaded Camera Raw settings from {file} ({n} not supported) {file} から Camera Raw の設定を読み込みました(未対応: {n})
Begin recording 記録を開始
Bend: 曲げ:
Bicubic バイキュービック
diff --git a/crates/ui-egui/src/i18n/ko.tsv b/crates/ui-egui/src/i18n/ko.tsv
index 0e31d4893..3609ad270 100644
--- a/crates/ui-egui/src/i18n/ko.tsv
+++ b/crates/ui-egui/src/i18n/ko.tsv
@@ -819,6 +819,12 @@
Baseline shift 기준선 이동
Basic 기본
Before (Y) 이전 (Y)
+ Save Settings… 설정 저장…
+ Load Settings… 설정 불러오기…
+ Save these settings as a Camera Raw .xmp file 이 설정을 Camera Raw .xmp 파일로 저장
+ Load settings from a Camera Raw .xmp file Camera Raw .xmp 파일에서 설정 불러오기
+ Loaded Camera Raw settings from {file} {file}에서 Camera Raw 설정을 불러왔습니다
+ Loaded Camera Raw settings from {file} ({n} not supported) {file}에서 Camera Raw 설정을 불러왔습니다 (미지원 {n}개)
Begin recording 기록 시작
Bend: 구부림:
Bicubic 쌍입방
diff --git a/crates/ui-egui/src/i18n/nl.tsv b/crates/ui-egui/src/i18n/nl.tsv
index 270ec8935..abc3f3f5c 100644
--- a/crates/ui-egui/src/i18n/nl.tsv
+++ b/crates/ui-egui/src/i18n/nl.tsv
@@ -827,6 +827,12 @@
Baseline shift Basislijnverschuiving
Basic Basis
Before (Y) Voor (Y)
+ Save Settings… Instellingen opslaan…
+ Load Settings… Instellingen laden…
+ Save these settings as a Camera Raw .xmp file Deze instellingen opslaan als Camera Raw-.xmp-bestand
+ Load settings from a Camera Raw .xmp file Instellingen laden uit een Camera Raw-.xmp-bestand
+ Loaded Camera Raw settings from {file} Camera Raw-instellingen geladen uit {file}
+ Loaded Camera Raw settings from {file} ({n} not supported) Camera Raw-instellingen geladen uit {file} ({n} niet ondersteund)
Begin recording Opname starten
Bend: Buiging:
Bicubic Bicubisch
diff --git a/crates/ui-egui/src/i18n/pl.tsv b/crates/ui-egui/src/i18n/pl.tsv
index 39c1928ca..ddda4d88d 100644
--- a/crates/ui-egui/src/i18n/pl.tsv
+++ b/crates/ui-egui/src/i18n/pl.tsv
@@ -845,6 +845,12 @@
Baseline shift Przesunięcie linii bazowej
Basic Podstawowe
Before (Y) Przed (Y)
+ Save Settings… Zapisz ustawienia…
+ Load Settings… Wczytaj ustawienia…
+ Save these settings as a Camera Raw .xmp file Zapisz te ustawienia jako plik .xmp Camera Raw
+ Load settings from a Camera Raw .xmp file Wczytaj ustawienia z pliku .xmp Camera Raw
+ Loaded Camera Raw settings from {file} Wczytano ustawienia Camera Raw z pliku {file}
+ Loaded Camera Raw settings from {file} ({n} not supported) Wczytano ustawienia Camera Raw z pliku {file} (nieobsługiwane: {n})
Begin recording Rozpocznij nagrywanie
Bend: Zgięcie:
Bicubic Dwusześcienna
diff --git a/crates/ui-egui/src/i18n/pt-br.tsv b/crates/ui-egui/src/i18n/pt-br.tsv
index 17247be9b..05408b834 100644
--- a/crates/ui-egui/src/i18n/pt-br.tsv
+++ b/crates/ui-egui/src/i18n/pt-br.tsv
@@ -829,6 +829,12 @@
Baseline shift Deslocamento da linha de base
Basic Básico
Before (Y) Antes (Y)
+ Save Settings… Salvar configurações…
+ Load Settings… Carregar configurações…
+ Save these settings as a Camera Raw .xmp file Salvar estas configurações como arquivo .xmp do Camera Raw
+ Load settings from a Camera Raw .xmp file Carregar configurações de um arquivo .xmp do Camera Raw
+ Loaded Camera Raw settings from {file} Configurações do Camera Raw carregadas de {file}
+ Loaded Camera Raw settings from {file} ({n} not supported) Configurações do Camera Raw carregadas de {file} ({n} sem suporte)
Begin recording Iniciar gravação
Bend: Curvatura:
Bicubic Bicúbica
diff --git a/crates/ui-egui/src/i18n/ru.tsv b/crates/ui-egui/src/i18n/ru.tsv
index 0cd3f56b1..6e5ee708a 100644
--- a/crates/ui-egui/src/i18n/ru.tsv
+++ b/crates/ui-egui/src/i18n/ru.tsv
@@ -1681,6 +1681,12 @@
Show in Explorer Показать в Проводнике
Show in Folder Показать в папке
Before (Y) До (Y)
+ Save Settings… Сохранить настройки…
+ Load Settings… Загрузить настройки…
+ Save these settings as a Camera Raw .xmp file Сохранить эти настройки в файл Camera Raw .xmp
+ Load settings from a Camera Raw .xmp file Загрузить настройки из файла Camera Raw .xmp
+ Loaded Camera Raw settings from {file} Настройки Camera Raw загружены из {file}
+ Loaded Camera Raw settings from {file} ({n} not supported) Настройки Camera Raw загружены из {file} (не поддерживается: {n})
After (X) После (X)
Original Оригинал
Current Текущий
diff --git a/crates/ui-egui/src/i18n/tr.tsv b/crates/ui-egui/src/i18n/tr.tsv
index 1f69babad..4305ff7fa 100644
--- a/crates/ui-egui/src/i18n/tr.tsv
+++ b/crates/ui-egui/src/i18n/tr.tsv
@@ -3814,3 +3814,9 @@ cameraData Lens Lens
Gradient Preset Options Gradyan Ön Ayarı Seçenekleri
Import .GRD .GRD İçe Aktar
Choose a gradient file (.grd). Bir gradyan dosyası (.grd) seçin.
+ Save Settings… Ayarları Kaydet…
+ Load Settings… Ayarları Yükle…
+ Save these settings as a Camera Raw .xmp file Bu ayarları Camera Raw .xmp dosyası olarak kaydet
+ Load settings from a Camera Raw .xmp file Ayarları bir Camera Raw .xmp dosyasından yükle
+ Loaded Camera Raw settings from {file} Camera Raw ayarları {file} dosyasından yüklendi
+ Loaded Camera Raw settings from {file} ({n} not supported) Camera Raw ayarları {file} dosyasından yüklendi ({n} desteklenmiyor)
diff --git a/crates/ui-egui/src/i18n/uk.tsv b/crates/ui-egui/src/i18n/uk.tsv
index 253ca6b82..de4e42fc5 100644
--- a/crates/ui-egui/src/i18n/uk.tsv
+++ b/crates/ui-egui/src/i18n/uk.tsv
@@ -1662,6 +1662,12 @@
Show in Explorer Показати у Провіднику
Show in Folder Показати в теці
Before (Y) До (Y)
+ Save Settings… Зберегти налаштування…
+ Load Settings… Завантажити налаштування…
+ Save these settings as a Camera Raw .xmp file Зберегти ці налаштування у файл Camera Raw .xmp
+ Load settings from a Camera Raw .xmp file Завантажити налаштування з файлу Camera Raw .xmp
+ Loaded Camera Raw settings from {file} Налаштування Camera Raw завантажено з {file}
+ Loaded Camera Raw settings from {file} ({n} not supported) Налаштування Camera Raw завантажено з {file} (не підтримується: {n})
After (X) Після (X)
Original Оригінал
Current Поточний
diff --git a/crates/ui-egui/src/i18n/vi.tsv b/crates/ui-egui/src/i18n/vi.tsv
index 1d0e15b6e..5ed7ec483 100644
--- a/crates/ui-egui/src/i18n/vi.tsv
+++ b/crates/ui-egui/src/i18n/vi.tsv
@@ -1272,6 +1272,12 @@
Aqua Xanh ngọc
Balance Cân bằng
Before (Y) Trước (Y)
+ Save Settings… Lưu cài đặt…
+ Load Settings… Tải cài đặt…
+ Save these settings as a Camera Raw .xmp file Lưu các cài đặt này thành tệp .xmp Camera Raw
+ Load settings from a Camera Raw .xmp file Tải cài đặt từ tệp .xmp Camera Raw
+ Loaded Camera Raw settings from {file} Đã tải cài đặt Camera Raw từ {file}
+ Loaded Camera Raw settings from {file} ({n} not supported) Đã tải cài đặt Camera Raw từ {file} ({n} không được hỗ trợ)
Blacks Điểm đen
Blending Pha trộn
Blue Xanh dương
diff --git a/crates/ui-egui/src/i18n/zh-hans.tsv b/crates/ui-egui/src/i18n/zh-hans.tsv
index 7b1862545..29d2b57ea 100644
--- a/crates/ui-egui/src/i18n/zh-hans.tsv
+++ b/crates/ui-egui/src/i18n/zh-hans.tsv
@@ -848,6 +848,12 @@
Baseline shift 基线偏移
Basic 基本
Before (Y) 调整前(Y)
+ Save Settings… 存储设置…
+ Load Settings… 载入设置…
+ Save these settings as a Camera Raw .xmp file 将这些设置存储为 Camera Raw .xmp 文件
+ Load settings from a Camera Raw .xmp file 从 Camera Raw .xmp 文件载入设置
+ Loaded Camera Raw settings from {file} 已从 {file} 载入 Camera Raw 设置
+ Loaded Camera Raw settings from {file} ({n} not supported) 已从 {file} 载入 Camera Raw 设置({n} 项不支持)
Begin recording 开始录制
Bend: 弯曲:
Bicubic 双三次
diff --git a/crates/ui-egui/src/i18n/zh-hant.tsv b/crates/ui-egui/src/i18n/zh-hant.tsv
index abcc5cb71..36f523934 100644
--- a/crates/ui-egui/src/i18n/zh-hant.tsv
+++ b/crates/ui-egui/src/i18n/zh-hant.tsv
@@ -851,6 +851,12 @@
Baseline shift 基線位移
Basic 基本
Before (Y) 之前 (Y)
+ Save Settings… 儲存設定…
+ Load Settings… 載入設定…
+ Save these settings as a Camera Raw .xmp file 將這些設定儲存為 Camera Raw .xmp 檔案
+ Load settings from a Camera Raw .xmp file 從 Camera Raw .xmp 檔案載入設定
+ Loaded Camera Raw settings from {file} 已從 {file} 載入 Camera Raw 設定
+ Loaded Camera Raw settings from {file} ({n} not supported) 已從 {file} 載入 Camera Raw 設定({n} 項不支援)
Begin recording 開始記錄
Bend: 彎曲:
Bicubic 雙三次