LightCraft: An open-source non-destructive photo editor written by scratch in pure Rust
Merge PR #1215
Brandon Thomasb29a1a8cc27c
diff --cc crates/engine/src/cmd/mod.rsindex 41e3b0929,5718d6546..cc03423fb--- a/crates/engine/src/cmd/mod.rs+++ b/crates/engine/src/cmd/mod.rs@@@ -34,9 -32,8 +34,10 @@@ mod organizemod prefs;mod preset_files;pub mod previews;+ mod print;mod query;+pub mod recheck;+mod slideshow;mod sync;mod xmp;@@@ -158,8 -154,8 +159,9 @@@ pub fn command_specs() -> &'static [Comv.extend(xmp::specs());v.extend(preset_files::specs());v.extend(prefs::specs());+ v.extend(slideshow::specs());v.extend(export::specs());+ v.extend(print::specs());v.extend(before::specs());v.extend(browse::specs());v.extend(missing::specs());diff --cc crates/engine/src/lib.rsindex 7df97e837,c7d479dd8..2118004f8--- a/crates/engine/src/lib.rs+++ b/crates/engine/src/lib.rs@@@ -59,6 -57,8 +59,9 @@@ mod pdfpub mod preset_import;pub mod preset_luminar;pub mod presets;+ pub mod print;+ pub mod print_color;++pub mod print_pdf;pub mod proof;pub mod rename;pub mod segment;@@@ -1254,10 -1041,10 +1264,12 @@@ mod tests_prefs#[cfg(test)]mod tests_presets_scale;#[cfg(test)]+ mod tests_print;+ #[cfg(test)]mod tests_process;#[cfg(test)]+mod tests_recheck;+#[cfg(test)]mod tests_segment;#[cfg(test)]mod tests_settings_files;diff --cc crates/engine/src/print/output.rsindex 000000000,e1c69e373..37881fbb8mode 000000,100644..100644--- a/crates/engine/src/print/output.rs+++ b/crates/engine/src/print/output.rs@@@ -1,0 -1,136 +1,136 @@@+ //! Writes composed pages as a print-ready PDF: each page is converted to the job's colour target+ //! (a printer / paper profile, or sRGB / Adobe RGB when the printer manages colour) with its+ //! intent, black point compensation and print adjustment ([`crate::print_color`]), then embedded+ //! covering the paper as an ICC-tagged, losslessly compressed 16-bit (or 8-bit) image. A printer-//! profile is also named as the document's output intent ([`crate::pdf`]).++//! profile is also named as the document's output intent ([`crate::print_pdf`]).+ use super::{MAX_JOB_PAGES, PageRaster, PrintJob};-use crate::pdf::ImageData;+ use crate::print_color::PrintColorJob;++use crate::print_pdf::ImageData;+ use lightcraft_color::transfer::encode_srgb8;+ use lightcraft_color::{REC2020, SRGB};+ use lightcraft_pipeline::OutputSpace;+ use lightcraft_raster::Rgba8;++ /// Largest PDF produced, bytes.+ const MAX_PDF_BYTES: usize = 256 * 1024 * 1024;++ /// A Rec. 2020 page as 8-bit sRGB (out-of-gamut colours are clipped).+ pub fn page_to_srgb8(page: &PageRaster) -> Result<Rgba8, String> {+ let (w, h) = (page.width as usize, page.height as usize);+ let n = w.checked_mul(h).ok_or("page too large")?;+ if n == 0 || page.rgb.len() != n.checked_mul(3).ok_or("page too large")? {+ return Err("a page's pixel data does not match its size".into());+ }+ let trc = OutputSpace::Rec2020.trc();+ // 16-bit Rec. 2020 code → linear light, once per code value.+ let lut: Vec<f32> = (0..=u16::MAX).map(|v| trc.decode(f32::from(v) / 65535.0)).collect();+ let m = REC2020.to_space(&SRGB).to_f32();+ let mut out = Rgba8::new(w, h);+ for (dst, src) in out.data.iter_mut().zip(page.rgb.as_chunks::<3>().0) {+ let l = src.map(|v| lut.get(usize::from(v)).copied().unwrap_or(0.0));+ let row = |r: usize| m.get(r).map_or(0.0, |m| m[0] * l[0] + m[1] * l[1] + m[2] * l[2]);+ *dst = [encode_srgb8(row(0)), encode_srgb8(row(1)), encode_srgb8(row(2)), 255];+ }+ Ok(out)+ }++ /// The PDF for `pages` (all the same size): one page per raster, its MediaBox the paper size in+ /// points (`pixels / ppi * 72`) with the image covering it. Each page is converted and compressed+ /// in turn, so memory holds one page's device samples at a time.+ pub fn write(pages: &[PageRaster], job: &PrintJob, title: &str) -> Result<Vec<u8>, String> {+ let first = pages.first().ok_or("nothing to print")?;+ if pages.len() > MAX_JOB_PAGES {+ return Err(format!("a print is limited to {MAX_JOB_PAGES} pages"));+ }+ if !(first.ppi.is_finite() && first.ppi > 0.0) {+ return Err("a page has no resolution".into());+ }+ let points = |px: u32| f64::from(px) / f64::from(first.ppi) * 72.0;+ let size = (points(first.width), points(first.height));+ let color = PrintColorJob::new(&job.color)?;+ let mut out = Vec::with_capacity(pages.len());+ let mut bytes = 0usize;+ for page in pages {+ if (page.width, page.height) != (first.width, first.height) {+ return Err("all pages of a PDF must be the same size".into());+ }+ let image = color.page_image(page.width, page.height, &page.rgb)?.deflated()?;+ if let ImageData::Flate { data, .. } = &image.data {+ bytes = bytes.saturating_add(data.len());+ }+ if bytes > MAX_PDF_BYTES {+ return Err("the PDF would exceed 256 MiB; lower the print resolution, use 8 bits or print fewer pages".into());+ }+ out.push((size, image));+ }+ color.pdf(out, title)+ }++ #[cfg(test)]+ mod tests {+ use super::*;+ use crate::print::compose::rec2020_from_srgb8;++ fn raster(w: u32, h: u32, srgb: [u8; 3]) -> PageRaster {+ let c = rec2020_from_srgb8(srgb);+ PageRaster { width: w, height: h, ppi: 100.0, rgb: (0..w * h).flat_map(|_| c).collect() }+ }++ #[test]+ fn colours_survive_the_round_trip() {+ for c in [[255u8, 255, 255], [0, 0, 0], [128, 128, 128], [200, 30, 30], [10, 200, 90]] {+ let px = page_to_srgb8(&raster(2, 2, c)).unwrap().data[0];+ for k in 0..3 {+ assert!(px[k].abs_diff(c[k]) <= 1, "{c:?} -> {px:?}");+ }+ }+ assert!(page_to_srgb8(&PageRaster { width: 2, height: 2, ppi: 100.0, rgb: vec![0; 5] }).is_err());+ assert!(page_to_srgb8(&PageRaster { width: 0, height: 2, ppi: 100.0, rgb: vec![] }).is_err());+ }++ #[test]+ fn pdf_pages_have_the_paper_size() {+ let pages = [raster(425, 550, [255, 255, 255]), raster(425, 550, [0, 0, 255])];+ let bytes = write(&pages, &PrintJob::default(), "t").unwrap();+ let text = String::from_utf8_lossy(&bytes);+ assert!(text.starts_with("%PDF-"));+ assert!(text.contains("/Count 2"));+ let at = text.find("/MediaBox [").unwrap() + "/MediaBox [".len();+ let nums: Vec<f64> = text[at..].split(']').next().unwrap().split_whitespace().map(|v| v.parse().unwrap()).collect();+ assert_eq!((nums[2], nums[3]), (306.0, 396.0), "4.25 x 5.5 in is 306 x 396 pt");+ assert!(text.contains("/Width 425 /Height 550"));+ // managed by the printer: sRGB, 16 bits, tagged, no output intent+ assert!(text.contains("/ICCBased") && text.contains("/BitsPerComponent 16") && !text.contains("/OutputIntents"));+ assert!(write(&[], &PrintJob::default(), "t").is_err());+ let mixed = [raster(10, 10, [0; 3]), raster(10, 12, [0; 3])];+ assert!(write(&mixed, &PrintJob::default(), "t").is_err());+ let bad = PageRaster { ppi: f32::NAN, ..raster(4, 4, [0; 3]) };+ assert!(write(&[bad], &PrintJob::default(), "t").is_err());+ let zero = PageRaster { ppi: 0.0, ..raster(4, 4, [0; 3]) };+ assert!(write(&[zero], &PrintJob::default(), "t").is_err());+ }++ #[test]+ fn a_printer_profile_is_converted_to_and_named_as_the_output_intent() {+ use crate::print_color::{PrintColorSettings, PrintIntent, PrintProfile};+ let dir = std::env::temp_dir().join(format!("lc-print-output-{}", std::process::id()));+ std::fs::create_dir_all(&dir).unwrap();+ let icc = dir.join("Lustre Paper.icc");+ std::fs::write(&icc, lightcraft_codecs::icc::write_named(lightcraft_codecs::NamedSpace::AdobeRgb)).unwrap();+ let color =+ PrintColorSettings { profile: PrintProfile::Icc { path: icc }, intent: PrintIntent::Relative, sixteen_bit: false, ..Default::default() };+ let job = PrintJob { color, ..Default::default() };+ let bytes = write(&[raster(20, 30, [200, 30, 30])], &job, "Lustre").unwrap();+ let text = String::from_utf8_lossy(&bytes);+ assert!(text.contains("/OutputIntents") && text.contains("/DestOutputProfile"), "{}", &text[..text.len().min(500)]);+ assert!(text.contains("/BitsPerComponent 8") && text.contains("/Title (Lustre)"));+ // a profile that isn't one fails the print and says which file+ std::fs::write(dir.join("Junk.icc"), [7u8; 200]).unwrap();+ let junk = PrintJob {+ color: PrintColorSettings { profile: PrintProfile::Icc { path: dir.join("Junk.icc") }, ..Default::default() },+ ..Default::default()+ };+ let err = write(&[raster(2, 2, [0; 3])], &junk, "t").unwrap_err();+ assert!(err.contains("Junk"), "{err}");+ }+ }diff --cc crates/engine/src/print_color.rsindex 000000000,c897f8990..562b75129mode 000000,100644..100644--- a/crates/engine/src/print_color.rs+++ b/crates/engine/src/print_color.rs@@@ -1,0 -1,386 +1,386 @@@+ //! The print job's colour: which profile composed pages are converted to and how, print sharpening+ //! for the paper, and the print-ready PDF they end up in.+ //!+ //! - **Profile**: "Managed by Printer" sends the page in sRGB or Adobe RGB with that profile+ //! embedded (the driver converts); a printer / paper ICC profile converts the page to the device's+ //! own values here and names the profile as the document's output intent, so the driver must not+ //! convert again.+ //! - **Intent, black point compensation, print adjustment**: [`lightcraft_codecs::print`].+ //! - **Print sharpening** (Low / Standard / High for Matte or Glossy paper): each photo is sharpened+ //! at its print size before it goes on the page, with the export sharpener.+ //! - **Depth**: 16 bits per component by default (no banding from the profile conversion); 8 bits+ //! for smaller files.+ //!+ //! Pages arrive as 16-bit RGB in the `Rec2020` output encoding, the composed page of the layout.++ use std::path::{Path, PathBuf};+ use std::sync::Arc;++ use lightcraft_codecs::display::MAX_PROFILE_BYTES;+ use lightcraft_codecs::print::{PrintColor, PrintTarget, PrintTransform};+ use lightcraft_codecs::{NamedSpace, proof::ProofIntent};+ use serde::{Deserialize, Serialize};++ use crate::export::{DeepImage, DeepSamples, OutputSpace, SharpenAmount, SharpenFor, output_sharpen_deep};-use crate::pdf::{ImageData, OutputIntent, PdfImage, PdfInfo, PdfPage, Placement};++use crate::print_pdf::{ImageData, OutputIntent, PdfImage, PdfInfo, PdfPage, Placement};++ /// The colour space a printer that manages colour receives.+ #[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Serialize, Deserialize)]+ #[serde(rename_all = "camelCase")]+ pub enum ManagedSpace {+ #[default]+ Srgb,+ AdobeRgb,+ }++ /// Where the print's colours go.+ #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]+ #[serde(rename_all = "camelCase", tag = "kind")]+ pub enum PrintProfile {+ /// Managed by Printer: the page goes in this space and the driver converts it.+ Managed { space: ManagedSpace },+ /// A printer / paper profile (an `.icc` / `.icm` file): converted here.+ Icc { path: PathBuf },+ }++ impl Default for PrintProfile {+ fn default() -> Self {+ PrintProfile::Managed { space: ManagedSpace::Srgb }+ }+ }++ #[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Serialize, Deserialize)]+ #[serde(rename_all = "camelCase")]+ pub enum PrintIntent {+ #[default]+ Perceptual,+ Relative,+ }++ /// Print sharpening strength (Off leaves the photos as rendered).+ #[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Serialize, Deserialize)]+ #[serde(rename_all = "camelCase")]+ pub enum PrintSharpen {+ Off,+ Low,+ #[default]+ Standard,+ High,+ }++ /// The paper print sharpening is tuned for.+ #[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Serialize, Deserialize)]+ #[serde(rename_all = "camelCase")]+ pub enum PrintMedia {+ Matte,+ #[default]+ Glossy,+ }++ /// The print job's colour settings, as saved with print templates.+ #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]+ #[serde(default, rename_all = "camelCase")]+ pub struct PrintColorSettings {+ pub profile: PrintProfile,+ pub intent: PrintIntent,+ /// Map the page's black to the paper's darkest (relative colorimetric).+ pub black_point_compensation: bool,+ /// Print adjustment, −100..100.+ pub brightness: f32,+ /// Print adjustment, −100..100.+ pub contrast: f32,+ pub sharpen: PrintSharpen,+ pub media: PrintMedia,+ /// 16 bits per component in the PDF (else 8).+ pub sixteen_bit: bool,+ }++ impl Default for PrintColorSettings {+ fn default() -> Self {+ PrintColorSettings {+ profile: PrintProfile::default(),+ intent: PrintIntent::default(),+ black_point_compensation: true,+ brightness: 0.0,+ contrast: 0.0,+ sharpen: PrintSharpen::default(),+ media: PrintMedia::default(),+ sixteen_bit: true,+ }+ }+ }++ impl PrintColorSettings {+ /// Refuse settings a command or template shouldn't carry (out-of-range adjustments, an empty+ /// profile path); whether the profile file is usable is checked when the job is built.+ pub fn validate(&self) -> Result<(), String> {+ for (name, v) in [("brightness", self.brightness), ("contrast", self.contrast)] {+ if !(v.is_finite() && (-100.0..=100.0).contains(&v)) {+ return Err(format!("{name} must be a number from -100 to 100"));+ }+ }+ if let PrintProfile::Icc { path } = &self.profile+ && path.as_os_str().is_empty()+ {+ return Err("the printer profile needs a path".into());+ }+ Ok(())+ }++ /// Sharpen one photo for the paper, at the size it prints (before it goes on the page).+ pub fn sharpen_photo(&self, photo: &mut DeepImage) {+ let amount = match self.sharpen {+ PrintSharpen::Off => return,+ PrintSharpen::Low => SharpenAmount::Low,+ PrintSharpen::Standard => SharpenAmount::Standard,+ PrintSharpen::High => SharpenAmount::High,+ };+ let target = match self.media {+ PrintMedia::Matte => SharpenFor::Matte,+ PrintMedia::Glossy => SharpenFor::Glossy,+ };+ output_sharpen_deep(photo, target, amount);+ }+ }++ /// Read a printer profile, refusing files that can't be one (the parse happens later).+ fn read_profile(path: &Path) -> Result<Vec<u8>, String> {+ let shown = path.file_name().map(|n| n.to_string_lossy().into_owned()).unwrap_or_else(|| path.display().to_string());+ let len = std::fs::metadata(path).map_err(|e| format!("can't read the printer profile {shown}: {e}"))?.len();+ if len > MAX_PROFILE_BYTES as u64 {+ return Err(format!("the printer profile {shown} is too large"));+ }+ std::fs::read(path).map_err(|e| format!("can't read the printer profile {shown}: {e}"))+ }++ /// A print job's colour, ready to apply: the conversion built once and what the PDF needs to know.+ #[derive(Debug)]+ pub struct PrintColorJob {+ pub settings: PrintColorSettings,+ transform: PrintTransform,+ /// The printing condition named in the PDF (only for a printer profile).+ intent: Option<OutputIntent>,+ }++ impl PrintColorJob {+ /// Build the job's conversion. Errors name the profile and what's wrong with it.+ pub fn new(settings: &PrintColorSettings) -> Result<PrintColorJob, String> {+ let s = settings.clone();+ let color = PrintColor {+ intent: match s.intent {+ PrintIntent::Perceptual => ProofIntent::Perceptual,+ PrintIntent::Relative => ProofIntent::Relative,+ },+ black_point_compensation: s.black_point_compensation,+ brightness: s.brightness,+ contrast: s.contrast,+ };+ let (target, name) = match &s.profile {+ PrintProfile::Managed { space } => {+ (PrintTarget::Managed(if *space == ManagedSpace::AdobeRgb { NamedSpace::AdobeRgb } else { NamedSpace::Srgb }), None)+ }+ PrintProfile::Icc { path } => {+ let name = path.file_stem().map(|n| n.to_string_lossy().into_owned()).unwrap_or_default();+ (PrintTarget::Profile(Arc::new(read_profile(path)?)), Some(name))+ }+ };+ let transform = PrintTransform::new(&target, &color).map_err(|e| match &name {+ Some(n) => format!("the printer profile {n}: {e}"),+ None => e,+ })?;+ let intent = name.map(|file| OutputIntent {+ icc: Arc::clone(transform.icc()),+ channels: transform.channels() as u8,+ condition: transform.description().map(str::to_owned).unwrap_or(file),+ });+ Ok(PrintColorJob { settings: s, transform, intent })+ }++ /// Sharpen one photo for the paper ([`PrintColorSettings::sharpen_photo`]).+ pub fn sharpen_photo(&self, photo: &mut DeepImage) {+ self.settings.sharpen_photo(photo);+ }++ /// Convert a composed page (16-bit RGB, `Rec2020` output encoding) to the PDF image that covers+ /// it, in the target's colours.+ pub fn page_image(&self, width: u32, height: u32, rgb: &[u16]) -> Result<PdfImage, String> {+ let want = u64::from(width).checked_mul(u64::from(height)).and_then(|p| p.checked_mul(3));+ if width == 0 || height == 0 || want != Some(rgb.len() as u64) {+ return Err(format!("a page of {width} × {height} pixels can't be made from {} samples", rgb.len()));+ }+ let device = self.transform.apply(rgb)?;+ let channels = self.transform.channels() as u8;+ let icc = Some(Arc::clone(self.transform.icc()));+ Ok(if self.settings.sixteen_bit {+ PdfImage::from_u16(width, height, channels, &device, icc)+ } else {+ let samples = device.iter().map(|&v| ((u32::from(v) * 255 + 32767) / 65535) as u8).collect();+ PdfImage { width, height, channels, data: ImageData::Raw { bits: 8, samples }, icc }+ })+ }++ /// The print-ready document: each page image covers its page (`size` in points).+ pub fn pdf(&self, pages: Vec<((f64, f64), PdfImage)>, title: &str) -> Result<Vec<u8>, String> {+ let pages: Vec<PdfPage> = pages+ .into_iter()+ .map(|((w, h), image)| PdfPage { width: w, height: h, images: vec![(image, Placement { x: 0.0, y: 0.0, width: w, height: h })] })+ .collect();+ let title = (!title.trim().is_empty()).then(|| title.to_owned());- crate::pdf::write(&pages, &PdfInfo { title, output_intent: self.intent.clone() })++ crate::print_pdf::write(&pages, &PdfInfo { title, output_intent: self.intent.clone() })+ }++ /// Samples per pixel the pages are converted to (3 RGB, 4 CMYK, 1 grey).+ pub fn channels(&self) -> usize {+ self.transform.channels()+ }++ /// The profile's description (or file name) for the job's summary.+ pub fn profile_name(&self) -> Option<&str> {+ self.intent.as_ref().map(|i| i.condition.as_str()).or(self.transform.description())+ }+ }++ /// A photo rendered for the page as the layout gets it from the export renderer.+ pub fn is_print_ready(photo: &DeepImage) -> bool {+ photo.space == OutputSpace::Rec2020 && matches!(photo.samples, DeepSamples::U16(_))+ }++ #[cfg(test)]+ mod tests {+ use super::*;+ use lightcraft_codecs::print::print_adjust;++ fn scratch(name: &str) -> PathBuf {+ let dir = std::env::temp_dir().join(format!("lc-print-color-{}-{name}", std::process::id()));+ std::fs::create_dir_all(&dir).unwrap();+ dir+ }++ /// A small, flat page of one 16-bit colour.+ fn page(w: u32, h: u32, v: [u16; 3]) -> Vec<u16> {+ (0..w * h).flat_map(|_| v).collect()+ }++ #[test]+ fn settings_default_and_round_trip() {+ let d = PrintColorSettings::default();+ assert_eq!(d.profile, PrintProfile::Managed { space: ManagedSpace::Srgb });+ assert!(d.black_point_compensation && d.sixteen_bit);+ let s = PrintColorSettings {+ profile: PrintProfile::Icc { path: "/Library/ColorSync/Profiles/Paper.icc".into() },+ intent: PrintIntent::Relative,+ brightness: 12.0,+ sharpen: PrintSharpen::High,+ media: PrintMedia::Matte,+ ..d.clone()+ };+ let json = serde_json::to_value(&s).unwrap();+ assert_eq!(json["profile"]["kind"], "icc");+ assert_eq!(json["intent"], "relative");+ assert_eq!(serde_json::from_value::<PrintColorSettings>(json).unwrap(), s);+ // partial and unknown-free JSON fills in the defaults+ let partial: PrintColorSettings = serde_json::from_str(r#"{"intent":"relative"}"#).unwrap();+ assert_eq!(partial, PrintColorSettings { intent: PrintIntent::Relative, ..d });+ assert!(serde_json::from_str::<PrintColorSettings>(r#"{"profile":{"kind":"cmyk"}}"#).is_err());+ }++ #[test]+ fn managed_srgb_page_becomes_a_16_bit_srgb_pdf_without_an_output_intent() {+ let job = PrintColorJob::new(&PrintColorSettings::default()).unwrap();+ let img = job.page_image(4, 2, &page(4, 2, [65535, 65535, 65535])).unwrap();+ assert_eq!((img.channels, img.width, img.height), (3, 4, 2));+ let ImageData::Raw { bits: 16, samples } = &img.data else { panic!("16-bit samples") };+ assert!(samples.chunks(2).all(|b| u16::from_be_bytes([b[0], b[1]]) > 65400), "white stays white");+ let pdf = job.pdf(vec![((288.0, 144.0), img)], "Prints").unwrap();+ let s = String::from_utf8_lossy(&pdf);+ assert!(s.contains("/ICCBased") && s.contains("/BitsPerComponent 16") && s.contains("/MediaBox [0 0 288 144]"));+ assert!(!s.contains("/OutputIntents"), "the printer converts: no output intent");+ assert!(s.contains("/Title (Prints)"));+ }++ #[test]+ fn a_printer_profile_converts_and_becomes_the_output_intent() {+ let dir = scratch("icc");+ let path = dir.join("Studio Glossy.icc");+ std::fs::write(&path, lightcraft_codecs::icc::write_named(NamedSpace::AdobeRgb)).unwrap();+ let settings =+ PrintColorSettings { profile: PrintProfile::Icc { path }, intent: PrintIntent::Relative, sixteen_bit: false, ..Default::default() };+ let job = PrintColorJob::new(&settings).unwrap();+ assert_eq!(job.channels(), 3);+ let img = job.page_image(2, 2, &page(2, 2, [0, 65535, 0])).unwrap();+ assert!(matches!(&img.data, ImageData::Raw { bits: 8, .. }));+ let pdf = job.pdf(vec![((100.0, 100.0), img)], "").unwrap();+ let s = String::from_utf8_lossy(&pdf);+ assert!(s.contains("/OutputIntents") && s.contains("/BitsPerComponent 8"), "{}", &s[..s.len().min(600)]);+ assert!(!s.contains("/Title"), "an empty title is left out");+ assert!(job.profile_name().is_some());+ }++ #[test]+ fn profile_errors_name_the_file() {+ let dir = scratch("bad");+ let garbage = dir.join("Broken Paper.icc");+ std::fs::write(&garbage, [0u8; 300]).unwrap();+ let err = PrintColorJob::new(&PrintColorSettings { profile: PrintProfile::Icc { path: garbage }, ..Default::default() }).unwrap_err();+ assert!(err.contains("Broken Paper"), "{err}");+ let missing =+ PrintColorJob::new(&PrintColorSettings { profile: PrintProfile::Icc { path: dir.join("nope.icc") }, ..Default::default() }).unwrap_err();+ assert!(missing.contains("nope.icc"), "{missing}");+ }++ #[test]+ fn print_adjustment_reaches_the_page() {+ let mid = [32768u16; 3];+ let plain = PrintColorJob::new(&PrintColorSettings::default()).unwrap().page_image(1, 1, &mid).unwrap();+ let bright = PrintColorJob::new(&PrintColorSettings { brightness: 60.0, ..Default::default() }).unwrap().page_image(1, 1, &mid).unwrap();+ let first = |i: &PdfImage| match &i.data {+ ImageData::Raw { samples, .. } => u16::from_be_bytes([samples[0], samples[1]]),+ ImageData::Jpeg(_) | ImageData::Flate { .. } => 0,+ };+ assert!(first(&bright) > first(&plain) + 1500, "{} vs {}", first(&bright), first(&plain));+ assert!(print_adjust(0.5, 60.0, 0.0) > 0.5);+ }++ #[test]+ fn print_sharpening_follows_the_setting() {+ // a hard vertical edge in a 16-bit Rec2020 photo+ let (w, h) = (8usize, 4usize);+ let samples: Vec<u16> = (0..w * h).flat_map(|i| if i % w < w / 2 { [20000u16; 3] } else { [40000u16; 3] }).collect();+ let photo = DeepImage { width: w, height: h, space: OutputSpace::Rec2020, samples: DeepSamples::U16(samples) };+ assert!(is_print_ready(&photo));+ let sharpened = |s: PrintSharpen| {+ let job = PrintColorJob::new(&PrintColorSettings { sharpen: s, media: PrintMedia::Matte, ..Default::default() }).unwrap();+ let mut p = photo.clone();+ job.sharpen_photo(&mut p);+ p+ };+ assert_eq!(sharpened(PrintSharpen::Off), photo);+ let edge = |p: &DeepImage| match &p.samples {+ DeepSamples::U16(v) => (v[(w / 2 - 1) * 3], v[(w / 2) * 3]),+ DeepSamples::F32(_) => (0, 0),+ };+ let (dark, light) = edge(&sharpened(PrintSharpen::High));+ assert!(dark < 20000 && light > 40000, "the edge gets more contrast: {dark} {light}");+ }++ #[test]+ fn validation_refuses_out_of_range_settings() {+ assert!(PrintColorSettings::default().validate().is_ok());+ for (b, c) in [(101.0, 0.0), (0.0, -100.5), (f32::NAN, 0.0), (0.0, f32::INFINITY)] {+ assert!(PrintColorSettings { brightness: b, contrast: c, ..Default::default() }.validate().is_err(), "{b} {c}");+ }+ assert!(PrintColorSettings { profile: PrintProfile::Icc { path: PathBuf::new() }, ..Default::default() }.validate().is_err());+ assert!(PrintColorSettings { brightness: -100.0, contrast: 100.0, ..Default::default() }.validate().is_ok());+ }++ #[test]+ fn hostile_pages_are_errors() {+ let job = PrintColorJob::new(&PrintColorSettings::default()).unwrap();+ assert!(job.page_image(0, 1, &[]).is_err());+ assert!(job.page_image(2, 2, &[0; 11]).is_err());+ assert!(job.page_image(u32::MAX, u32::MAX, &[0; 3]).is_err());+ let img = job.page_image(1, 1, &[0; 3]).unwrap();+ assert!(job.pdf(vec![((f64::NAN, 10.0), img)], "x").is_err());+ assert!(job.pdf(vec![], "x").is_err());+ }+ }diff --cc crates/engine/src/print_pdf.rsindex 000000000,000000000..abce4061enew file mode 100644--- /dev/null+++ b/crates/engine/src/print_pdf.rs@@@ -1,0 -1,0 +1,520 @@@++//! A small PDF writer for print output: pages of a given size in points, each with raster images++//! placed on it, tagged with their ICC profile (`ICCBased`) so the numbers mean the same colour in++//! every reader and RIP, Flate-compressed (lossless) at 8 or 16 bits per component, or carried as++//! JPEG (`DCTDecode`) where small files matter more than exact samples. Optionally an output intent:++//! the printing condition (the printer / paper profile) the file was made for, as PDF/X readers++//! expect it in the catalog. Profiles shared by several images are written once.++//!++//! The file is PDF 1.6 (16-bit images need 1.5): classic cross-reference table, no object streams,++//! deterministic (no dates or IDs), so the same pages always give the same bytes.++//!++//! Sources: ISO 32000-1:2008 (§7.3 objects, §7.5 file structure, §8.6.5.5 ICCBased colour spaces,++//! §8.9 images, §14.11.5 output intents). Own design.++++use std::collections::HashMap;++use std::sync::Arc;++++/// Pages per document: a print job beyond this is a mistake, not a book.++pub const MAX_PAGES: usize = 1000;++/// Images per page.++pub const MAX_IMAGES_PER_PAGE: usize = 256;++/// Largest page side in points (200 inches): more than any printer's roll.++pub const MAX_PAGE_POINTS: f64 = 14_400.0;++/// Largest image, in pixels per side.++pub const MAX_IMAGE_SIDE: u32 = 65_535;++++/// How an image's samples are stored.++#[derive(Clone, Debug, PartialEq)]++pub enum ImageData {++ /// Interleaved samples, `bits` (8 or 16) per component, 16-bit values big-endian: compressed++ /// losslessly in the file.++ Raw { bits: u8, samples: Vec<u8> },++ /// A baseline JPEG stream, copied into the file as it is.++ Jpeg(Vec<u8>),++ /// Samples already compressed with zlib (see [`PdfImage::deflated`]), `bits` per component.++ Flate { bits: u8, data: Vec<u8> },++}++++/// A raster image and the colour space its samples are in.++#[derive(Clone, Debug, PartialEq)]++pub struct PdfImage {++ pub width: u32,++ pub height: u32,++ /// Components per pixel: 1 (grey), 3 (RGB) or 4 (CMYK).++ pub channels: u8,++ pub data: ImageData,++ /// The ICC profile the samples are in; without one the image is device colour.++ pub icc: Option<Arc<Vec<u8>>>,++}++++impl PdfImage {++ /// An image from interleaved 16-bit samples.++ pub fn from_u16(width: u32, height: u32, channels: u8, samples: &[u16], icc: Option<Arc<Vec<u8>>>) -> PdfImage {++ let bytes = samples.iter().flat_map(|v| v.to_be_bytes()).collect();++ PdfImage { width, height, channels, data: ImageData::Raw { bits: 16, samples: bytes }, icc }++ }++++ /// The same image with its samples compressed now (checked first), so a long print doesn't++ /// hold every page's uncompressed samples until the file is written.++ pub fn deflated(self) -> Result<PdfImage, String> {++ self.check()?;++ let data = match self.data {++ ImageData::Raw { bits, samples } => ImageData::Flate { bits, data: deflate(&samples) },++ other => other,++ };++ Ok(PdfImage { data, ..self })++ }++++ fn check(&self) -> Result<(), String> {++ if self.width == 0 || self.height == 0 || self.width > MAX_IMAGE_SIDE || self.height > MAX_IMAGE_SIDE {++ return Err(format!("an image of {} × {} pixels can't be written", self.width, self.height));++ }++ if !matches!(self.channels, 1 | 3 | 4) {++ return Err(format!("images have 1, 3 or 4 components, not {}", self.channels));++ }++ match &self.data {++ ImageData::Raw { bits, samples } => {++ if !matches!(bits, 8 | 16) {++ return Err(format!("images have 8 or 16 bits per component, not {bits}"));++ }++ let want = u64::from(self.width) * u64::from(self.height) * u64::from(self.channels) * u64::from(bits / 8);++ if samples.len() as u64 != want {++ return Err(format!("the image needs {want} bytes of samples, not {}", samples.len()));++ }++ }++ ImageData::Jpeg(data) => {++ if !data.starts_with(&[0xFF, 0xD8]) {++ return Err("the image isn't a JPEG stream".into());++ }++ }++ ImageData::Flate { bits, data } => {++ if !matches!(bits, 8 | 16) || data.is_empty() {++ return Err("a compressed image has 8 or 16 bits per component and some data".into());++ }++ }++ }++ Ok(())++ }++}++++/// Where an image goes on its page, in points from the page's bottom-left corner.++#[derive(Clone, Copy, Debug, PartialEq)]++pub struct Placement {++ pub x: f64,++ pub y: f64,++ pub width: f64,++ pub height: f64,++}++++/// One page: its size in points and the images on it, drawn in order (later ones on top).++#[derive(Clone, Debug, PartialEq)]++pub struct PdfPage {++ pub width: f64,++ pub height: f64,++ pub images: Vec<(PdfImage, Placement)>,++}++++/// The printing condition the document is made for (PDF/X-style output intent).++#[derive(Clone, Debug, PartialEq)]++pub struct OutputIntent {++ /// The printer / paper profile.++ pub icc: Arc<Vec<u8>>,++ /// Its components: 1, 3 or 4.++ pub channels: u8,++ /// A name for the condition (the profile's description).++ pub condition: String,++}++++/// Document-level settings.++#[derive(Clone, Debug, Default, PartialEq)]++pub struct PdfInfo {++ pub title: Option<String>,++ pub output_intent: Option<OutputIntent>,++}++++fn finite(v: f64) -> bool {++ v.is_finite()++}++++/// A number as PDF writes it: up to four decimals, no exponent, no trailing zeros.++fn num(v: f64) -> String {++ let s = format!("{:.4}", if finite(v) { v } else { 0.0 });++ let s = s.trim_end_matches('0').trim_end_matches('.');++ if s == "-0" || s.is_empty() { "0".into() } else { s.into() }++}++++/// A text string: plain ASCII as a literal string, anything else as UTF-16BE with a byte order mark.++fn text(s: &str) -> String {++ if s.bytes().all(|b| (0x20..0x7f).contains(&b)) {++ let mut out = String::with_capacity(s.len() + 2);++ out.push('(');++ for c in s.chars() {++ if matches!(c, '(' | ')' | '\\') {++ out.push('\\');++ }++ out.push(c);++ }++ out.push(')');++ out++ } else {++ let mut out = String::from("<FEFF");++ for unit in s.encode_utf16() {++ out.push_str(&format!("{unit:04X}"));++ }++ out.push('>');++ out++ }++}++++struct Writer {++ out: Vec<u8>,++ offsets: Vec<usize>,++}++++impl Writer {++ /// Reserve an object number (filled later by [`Writer::object`]).++ fn reserve(&mut self) -> usize {++ self.offsets.push(0);++ self.offsets.len()++ }++++ fn object(&mut self, id: usize, dict: &str, stream: Option<&[u8]>) {++ if let Some(slot) = self.offsets.get_mut(id.wrapping_sub(1)) {++ *slot = self.out.len();++ }++ self.out.extend_from_slice(format!("{id} 0 obj\n{dict}").as_bytes());++ if let Some(data) = stream {++ self.out.extend_from_slice(b"\nstream\n");++ self.out.extend_from_slice(data);++ self.out.extend_from_slice(b"\nendstream");++ }++ self.out.extend_from_slice(b"\nendobj\n");++ }++}++++fn deflate(data: &[u8]) -> Vec<u8> {++ miniz_oxide::deflate::compress_to_vec_zlib(data, 6)++}++++/// Write a document. Errors name the first page or image that can't be written.++pub fn write(pages: &[PdfPage], info: &PdfInfo) -> Result<Vec<u8>, String> {++ if pages.is_empty() {++ return Err("there are no pages to write".into());++ }++ if pages.len() > MAX_PAGES {++ return Err(format!("a document holds at most {MAX_PAGES} pages"));++ }++ for (n, page) in pages.iter().enumerate() {++ let n = n + 1;++ if !(finite(page.width) && finite(page.height))++ || page.width <= 0.0++ || page.height <= 0.0++ || page.width > MAX_PAGE_POINTS++ || page.height > MAX_PAGE_POINTS++ {++ return Err(format!("page {n} has no usable size"));++ }++ if page.images.len() > MAX_IMAGES_PER_PAGE {++ return Err(format!("page {n} has more than {MAX_IMAGES_PER_PAGE} images"));++ }++ for (image, at) in &page.images {++ image.check().map_err(|e| format!("page {n}: {e}"))?;++ if ![at.x, at.y, at.width, at.height].into_iter().all(finite) || at.width <= 0.0 || at.height <= 0.0 {++ return Err(format!("page {n}: an image has no usable placement"));++ }++ }++ }++ if let Some(intent) = &info.output_intent++ && !matches!(intent.channels, 1 | 3 | 4)++ {++ return Err("the output intent's profile has 1, 3 or 4 components".into());++ }++++ let mut w = Writer { out: Vec::new(), offsets: Vec::new() };++ w.out.extend_from_slice(b"%PDF-1.6\n%\xE2\xE3\xCF\xD3\n");++ let catalog = w.reserve();++ let pages_id = w.reserve();++ let info_id = w.reserve();++++ // ICC profiles, each written once (keyed by content) with its component count++ let mut profiles: HashMap<Vec<u8>, usize> = HashMap::new();++ let mut profile = |w: &mut Writer, icc: &Arc<Vec<u8>>, n: u8| -> usize {++ if let Some(&id) = profiles.get(icc.as_slice()) {++ return id;++ }++ let id = w.reserve();++ let data = deflate(icc);++ let alternate = match n {++ 1 => "/DeviceGray",++ 4 => "/DeviceCMYK",++ _ => "/DeviceRGB",++ };++ w.object(id, &format!("<< /N {n} /Alternate {alternate} /Filter /FlateDecode /Length {} >>", data.len()), Some(&data));++ profiles.insert(icc.to_vec(), id);++ id++ };++++ let intent_id = info.output_intent.as_ref().map(|intent| profile(&mut w, &intent.icc, intent.channels));++++ let mut kids = Vec::with_capacity(pages.len());++ for page in pages {++ let page_id = w.reserve();++ let mut xobjects = String::new();++ let mut content = String::new();++ for (k, (image, at)) in page.images.iter().enumerate() {++ let space = match &image.icc {++ Some(icc) => format!("[/ICCBased {} 0 R]", profile(&mut w, icc, image.channels)),++ None => match image.channels {++ 1 => "/DeviceGray".into(),++ 4 => "/DeviceCMYK".into(),++ _ => "/DeviceRGB".into(),++ },++ };++ let id = w.reserve();++ let (bits, filter, data): (u8, &str, std::borrow::Cow<[u8]>) = match &image.data {++ ImageData::Raw { bits, samples } => (*bits, "/FlateDecode", deflate(samples).into()),++ ImageData::Flate { bits, data } => (*bits, "/FlateDecode", data.as_slice().into()),++ ImageData::Jpeg(jpeg) => (8, "/DCTDecode", jpeg.as_slice().into()),++ };++ w.object(++ id,++ &format!(++ "<< /Type /XObject /Subtype /Image /Width {} /Height {} /ColorSpace {space} /BitsPerComponent {bits} /Filter {filter} /Length {} >>",++ image.width,++ image.height,++ data.len()++ ),++ Some(&data),++ );++ xobjects.push_str(&format!("/Im{k} {id} 0 R "));++ content.push_str(&format!("q {} 0 0 {} {} {} cm /Im{k} Do Q\n", num(at.width), num(at.height), num(at.x), num(at.y)));++ }++ let content_id = w.reserve();++ let stream = deflate(content.as_bytes());++ w.object(content_id, &format!("<< /Filter /FlateDecode /Length {} >>", stream.len()), Some(&stream));++ w.object(++ page_id,++ &format!(++ "<< /Type /Page /Parent {pages_id} 0 R /MediaBox [0 0 {} {}] /Resources << /XObject << {xobjects}>> >> /Contents {content_id} 0 R >>",++ num(page.width),++ num(page.height)++ ),++ None,++ );++ kids.push(format!("{page_id} 0 R"));++ }++ w.object(pages_id, &format!("<< /Type /Pages /Count {} /Kids [{}] >>", kids.len(), kids.join(" ")), None);++++ let intents = match (&info.output_intent, intent_id) {++ (Some(intent), Some(id)) => format!(++ " /OutputIntents [<< /Type /OutputIntent /S /GTS_PDFX /OutputConditionIdentifier (Custom) /Info {} /DestOutputProfile {id} 0 R >>]",++ text(&intent.condition)++ ),++ _ => String::new(),++ };++ w.object(catalog, &format!("<< /Type /Catalog /Pages {pages_id} 0 R{intents} >>"), None);++ let title = info.title.as_deref().map(|t| format!(" /Title {}", text(t))).unwrap_or_default();++ w.object(info_id, &format!("<< /Producer (LightCraft){title} >>"), None);++++ let xref = w.out.len();++ let mut table = format!("xref\n0 {}\n0000000000 65535 f \n", w.offsets.len() + 1);++ for offset in &w.offsets {++ table.push_str(&format!("{offset:010} 00000 n \n"));++ }++ table.push_str(&format!("trailer\n<< /Size {} /Root {catalog} 0 R /Info {info_id} 0 R >>\nstartxref\n{xref}\n%%EOF\n", w.offsets.len() + 1));++ w.out.extend_from_slice(table.as_bytes());++ Ok(w.out)++}++++#[cfg(test)]++mod tests {++ use super::*;++ use lightcraft_codecs::NamedSpace;++++ /// The body of object `id` (dictionary and raw stream bytes), found through the xref table.++ fn object(pdf: &[u8], id: usize) -> (String, Vec<u8>) {++ // byte offsets: the streams are binary, so search the bytes, not a lossy string++ let start = pdf.windows(10).rposition(|w| w == b"startxref\n").unwrap() + 10;++ let tail = std::str::from_utf8(&pdf[start..]).unwrap();++ let xref: usize = tail.lines().next().unwrap().trim().parse().unwrap();++ let table = std::str::from_utf8(&pdf[xref..]).unwrap();++ let line = table.lines().nth(2 + id).unwrap();++ let offset: usize = line[..10].parse().unwrap();++ let head = format!("{id} 0 obj\n");++ assert_eq!(&pdf[offset..offset + head.len()], head.as_bytes(), "xref entry for {id}");++ let rest = &pdf[offset + head.len()..];++ let end = rest.windows(7).position(|w| w == b"\nendobj").unwrap();++ let body = &rest[..end];++ match body.windows(8).position(|w| w == b"\nstream\n") {++ Some(p) => {++ let data = &body[p + 8..body.len() - "\nendstream".len()];++ (String::from_utf8_lossy(&body[..p]).into_owned(), data.to_vec())++ }++ None => (String::from_utf8_lossy(body).into_owned(), vec![]),++ }++ }++++ fn inflate(data: &[u8]) -> Vec<u8> {++ miniz_oxide::inflate::decompress_to_vec_zlib(data).unwrap()++ }++++ /// Object ids of every image XObject, in file order.++ fn images(pdf: &[u8]) -> Vec<usize> {++ let s = String::from_utf8_lossy(pdf);++ s.match_indices(" 0 obj\n<< /Type /XObject /Subtype /Image").map(|(i, _)| s[..i].rsplit('\n').next().unwrap().parse().unwrap()).collect()++ }++++ fn reference(dict: &str, key: &str) -> usize {++ let at = dict.find(key).unwrap() + key.len();++ dict[at..].trim_start().split(' ').next().unwrap().parse().unwrap()++ }++++ fn srgb() -> Arc<Vec<u8>> {++ Arc::new(lightcraft_codecs::icc::write_named(NamedSpace::Srgb))++ }++++ fn page(images: Vec<(PdfImage, Placement)>) -> PdfPage {++ PdfPage { width: 612.0, height: 792.0, images }++ }++++ fn full(w: f64, h: f64) -> Placement {++ Placement { x: 0.0, y: 0.0, width: w, height: h }++ }++++ #[test]++ fn a_16_bit_icc_image_round_trips() {++ let samples: Vec<u16> = (0..2 * 3 * 3).map(|i| (i * 3851) as u16).collect();++ let img = PdfImage::from_u16(3, 2, 3, &samples, Some(srgb()));++ let pdf = write(&[page(vec![(img, full(612.0, 792.0))])], &PdfInfo::default()).unwrap();++ assert!(pdf.starts_with(b"%PDF-1.6\n"));++ assert!(pdf.ends_with(b"%%EOF\n"));++ let ids = images(&pdf);++ assert_eq!(ids.len(), 1);++ let (dict, data) = object(&pdf, ids[0]);++ assert!(dict.contains("/Width 3 /Height 2") && dict.contains("/BitsPerComponent 16") && dict.contains("/FlateDecode"), "{dict}");++ let back: Vec<u16> = inflate(&data).chunks(2).map(|b| u16::from_be_bytes([b[0], b[1]])).collect();++ assert_eq!(back, samples);++ let (profile, icc) = object(&pdf, reference(&dict, "/ICCBased"));++ assert!(profile.contains("/N 3") && profile.contains("/Alternate /DeviceRGB"), "{profile}");++ assert_eq!(inflate(&icc), *srgb());++ assert_eq!(lightcraft_codecs::icc::parse(&inflate(&icc)).and_then(|i| i.named), Some(NamedSpace::Srgb));++ }++++ #[test]++ fn pages_sizes_placements_and_a_shared_profile() {++ let px = |v: u16| PdfImage::from_u16(1, 1, 3, &[v, v, v], Some(srgb()));++ let at = Placement { x: 36.0, y: 72.5, width: 288.0, height: 216.0 };++ let pages = [page(vec![(px(1), at), (px(2), full(612.0, 792.0))]), PdfPage { width: 841.89, height: 595.28, images: vec![(px(3), at)] }];++ let pdf = write(&pages, &PdfInfo::default()).unwrap();++ let s = String::from_utf8_lossy(&pdf);++ assert!(s.contains("/Type /Pages /Count 2"), "two pages");++ assert!(s.contains("/MediaBox [0 0 612 792]") && s.contains("/MediaBox [0 0 841.89 595.28]"));++ // the sRGB profile is written once for all three images++ assert_eq!(s.matches("/N 3 /Alternate").count(), 1);++ let first: Vec<_> = images(&pdf).iter().map(|&id| reference(&object(&pdf, id).0, "/ICCBased")).collect();++ assert!(first.windows(2).all(|w| w[0] == w[1]), "{first:?}");++ // placements reach the content streams++ let contents: Vec<String> = s++ .match_indices("/Contents ")++ .map(|(i, _)| s[i + 10..].split(' ').next().unwrap().parse::<usize>().unwrap())++ .map(|id| String::from_utf8(inflate(&object(&pdf, id).1)).unwrap())++ .collect();++ assert_eq!(contents[0], "q 288 0 0 216 36 72.5 cm /Im0 Do Q\nq 612 0 0 792 0 0 cm /Im1 Do Q\n");++ assert_eq!(write(&pages, &PdfInfo::default()).unwrap(), pdf, "deterministic");++ }++++ #[test]++ fn output_intent_and_title() {++ let cmyk_like = srgb();++ let info = PdfInfo {++ title: Some("Garden – prints (2)".into()),++ output_intent: Some(OutputIntent { icc: cmyk_like.clone(), channels: 3, condition: "Glossy (Photo) \\ test".into() }),++ };++ let img = PdfImage::from_u16(1, 1, 3, &[0, 0, 0], Some(cmyk_like));++ let pdf = write(&[page(vec![(img, full(10.0, 10.0))])], &info).unwrap();++ let (catalog, _) = object(&pdf, 1);++ assert!(catalog.contains("/OutputIntents [<< /Type /OutputIntent /S /GTS_PDFX"), "{catalog}");++ assert!(catalog.contains("/Info (Glossy \\(Photo\\) \\\\ test)"), "{catalog}");++ // the intent and the image share one profile object++ let dest = reference(&catalog, "/DestOutputProfile");++ assert_eq!(reference(&object(&pdf, images(&pdf)[0]).0, "/ICCBased"), dest);++ let (info_dict, _) = object(&pdf, 3);++ assert!(info_dict.contains("/Title <FEFF"), "non-ASCII titles are UTF-16: {info_dict}");++ assert!(info_dict.contains("2013"), "the en dash: {info_dict}");++ }++++ #[test]++ fn cmyk_grey_jpeg_and_device_images() {++ let jpeg = vec![0xFF, 0xD8, 0xFF, 0xD9];++ let imgs = vec![++ (++ PdfImage { width: 1, height: 1, channels: 4, data: ImageData::Raw { bits: 8, samples: vec![0, 10, 20, 30] }, icc: None },++ full(1.0, 1.0),++ ),++ (PdfImage { width: 2, height: 1, channels: 1, data: ImageData::Raw { bits: 8, samples: vec![0, 255] }, icc: None }, full(1.0, 1.0)),++ (PdfImage { width: 4, height: 4, channels: 3, data: ImageData::Jpeg(jpeg.clone()), icc: None }, full(1.0, 1.0)),++ ];++ let pdf = write(&[page(imgs)], &PdfInfo::default()).unwrap();++ let ids = images(&pdf);++ let dicts: Vec<_> = ids.iter().map(|&id| object(&pdf, id)).collect();++ assert!(dicts[0].0.contains("/ColorSpace /DeviceCMYK") && dicts[0].0.contains("/BitsPerComponent 8"));++ assert!(dicts[1].0.contains("/ColorSpace /DeviceGray"));++ assert!(dicts[2].0.contains("/DCTDecode") && dicts[2].0.contains("/DeviceRGB"));++ assert_eq!(dicts[2].1, jpeg, "JPEG streams are copied as they are");++ }++++ #[test]++ fn compressing_early_writes_the_same_file() {++ let samples: Vec<u16> = (0..4 * 3 * 3).map(|i| (i * 977) as u16).collect();++ let raw = PdfImage::from_u16(4, 3, 3, &samples, Some(srgb()));++ let early = raw.clone().deflated().unwrap();++ assert!(matches!(early.data, ImageData::Flate { bits: 16, .. }));++ let at = full(100.0, 75.0);++ let a = write(&[page(vec![(raw, at)])], &PdfInfo::default()).unwrap();++ let b = write(&[page(vec![(early, at)])], &PdfInfo::default()).unwrap();++ assert_eq!(a, b);++ let mut short = PdfImage::from_u16(4, 3, 3, &samples, None);++ short.width = 5;++ assert!(short.deflated().is_err(), "checked before compressing");++ }++++ #[test]++ fn hostile_documents_are_errors() {++ let ok = || PdfImage::from_u16(1, 1, 3, &[1, 2, 3], None);++ let at = full(10.0, 10.0);++ let bad = |pages: Vec<PdfPage>| write(&pages, &PdfInfo::default()).is_err();++ assert!(bad(vec![]));++ assert!(bad(vec![PdfPage { width: f64::NAN, height: 10.0, images: vec![] }]));++ assert!(bad(vec![PdfPage { width: -1.0, height: 10.0, images: vec![] }]));++ assert!(bad(vec![PdfPage { width: 1e9, height: 10.0, images: vec![] }]));++ assert!(bad(vec![page(vec![(ok(), Placement { x: f64::INFINITY, ..at })])]));++ assert!(bad(vec![page(vec![(ok(), Placement { width: 0.0, ..at })])]));++ let mut short = ok();++ short.data = ImageData::Raw { bits: 16, samples: vec![0; 5] };++ assert!(bad(vec![page(vec![(short, at)])]));++ let mut empty = ok();++ empty.width = 0;++ assert!(bad(vec![page(vec![(empty, at)])]));++ let mut odd = ok();++ odd.channels = 2;++ assert!(bad(vec![page(vec![(odd, at)])]));++ let mut not_jpeg = ok();++ not_jpeg.data = ImageData::Jpeg(vec![1, 2, 3]);++ assert!(bad(vec![page(vec![(not_jpeg, at)])]));++ let too_many = (0..MAX_PAGES + 1).map(|_| page(vec![])).collect();++ assert!(bad(too_many));++ let info = PdfInfo { title: None, output_intent: Some(OutputIntent { icc: srgb(), channels: 2, condition: String::new() }) };++ assert!(write(&[page(vec![])], &info).is_err());++ }++++ #[test]++ fn numbers_and_strings() {++ assert_eq!(num(612.0), "612");++ assert_eq!(num(72.5), "72.5");++ assert_eq!(num(-0.00001), "0");++ assert_eq!(num(f64::NAN), "0");++ assert_eq!(num(1.0 / 3.0), "0.3333");++ assert_eq!(text("a(b)c\\"), "(a\\(b\\)c\\\\)");++ assert_eq!(text("é"), "<FEFF00E9>");++ }++}diff --cc crates/ui-egui/src/lib.rsindex d4520bfa8,562847abe..d163d2250--- a/crates/ui-egui/src/lib.rs+++ b/crates/ui-egui/src/lib.rs@@@ -28,7 -26,7 +28,8 @@@ pub mod mergemod model_setup;pub mod panels;pub mod pick;+ pub mod print_view;+pub mod recheck;pub mod region;pub mod render;pub mod shortcuts;@@@ -123,22 -107,12 +124,24 @@@ mod tests_preset_import#[cfg(test)]mod tests_preview_limit;#[cfg(test)]+ mod tests_print;+ #[cfg(test)]+mod tests_profiles_layout;+#[cfg(test)]mod tests_quit_unsaved;#[cfg(test)]+mod tests_recheck;+#[cfg(test)]+mod tests_rename_person;+#[cfg(test)]+mod tests_sam_setup;+#[cfg(test)]mod tests_scroll;#[cfg(test)]+mod tests_slideshow;+#[cfg(test)]+mod tests_solo_sections;+#[cfg(test)]mod tests_switch_library;#[cfg(test)]mod tests_sync;diff --cc crates/ui-egui/src/menus.rsindex 2cea393de,b7fa7e45a..0f2b217bc--- a/crates/ui-egui/src/menus.rs+++ b/crates/ui-egui/src/menus.rs@@@ -2071,19 -1869,11 +2095,21 @@@ pub fn run_ui_command(app: &mut LightcrSome(r)}+/// Views whose bottom bar has the thumbnail-size slider and that draw tiles of that size.+fn thumb_size_view(app: &LightcraftApp) -> bool {+ matches!(app.ui.view, ViewMode::PhotoGrid | ViewMode::SquareGrid | ViewMode::People)+}+pub fn ui_enabled(app: &LightcraftApp, id: &str) -> bool {match id {+ "library.selectOnlyActive" => app.session.active().is_some(),+ "view.thumbSizeUp" | "view.thumbSizeDown" => thumb_size_view(app),- "dialog.contactSheet" | "app.contactSheet" => !cfg!(target_arch = "wasm32") && app.session.active().is_some() && app.export.is_none(),+ "dialog.contactSheet" | "app.contactSheet" | "dialog.print" | "app.print" => {+ !cfg!(target_arch = "wasm32") && app.session.active().is_some() && app.export.is_none()+ }+ "dialog.slideshowExport" | "app.slideshowExport" => {+ !cfg!(target_arch = "wasm32") && !app.session.slideshow_export.as_ref().is_some_and(|r| r.running())+ }s if s.starts_with("panel.") || s.starts_with("tool.") || s.starts_with("section.") => app.session.active().is_some() || s == "panel.close","app.export" | "dialog.export" | "dialog.createPreset" | "dialog.rename" | "dialog.captureTime" | "dialog.copySettings" => {app.session.active().is_some()diff --cc crates/ui-egui/src/panels/dialogs.rsindex a7779fcd6,ca1955da9..42dbde875--- a/crates/ui-egui/src/panels/dialogs.rs+++ b/crates/ui-egui/src/panels/dialogs.rs@@@ -253,7 -252,7 +254,8 @@@ pub fn show(app: &mut LightcraftApp, ctDialog::PasteSettings { .. } => "Paste Selected Settings",Dialog::Export { .. } => "Export",Dialog::ContactSheet { .. } => "Contact Sheet PDF",+ Dialog::SlideshowExport { .. } => "Export Slideshow",+ Dialog::Print => "Print",Dialog::Merge { opts } => opts.title(),Dialog::Settings { .. } => "Settings",Dialog::ConfirmDelete { .. } => "Delete Photos",@@@ -306,9 -293,9 +310,10 @@@Dialog::Import { .. } => crate::import::DIALOG_SIZE[0],Dialog::SmartRules { .. } => 680.0,Dialog::AllMetadata { .. } => 620.0,+ Dialog::Print => 1100.0,Dialog::FaceModel { .. } => 460.0,Dialog::LightroomCatalog { .. } => 440.0,+ Dialog::ManageEffects { .. } => 560.0,_ => 380.0,}).show(ctx, |ui| {@@@ -1328,9 -1233,8 +1334,10 @@@add_label = crate::i18n::tr_format!("{verb} {n} Photo{}", if n == 1 { "" } else { "s" }, verb = crate::i18n::tr(verb), n = n);add_label.as_str()}+ Dialog::LightroomResult { first: Some(_), .. } => "Show in Library",Dialog::ContactSheet { .. } => "Choose PDF…",+ Dialog::SlideshowExport { .. } => "Export…",+ Dialog::Print => "Print to PDF…",Dialog::Merge { .. } => "Merge",Dialog::DenoiseModel { info, .. } if info["download"].is_string() => "Accept & Download",Dialog::DenoiseModel { .. } => "Install",@@@ -1418,7 -1308,7 +1425,8 @@@Dialog::Import { .. }| Dialog::Export { .. }| Dialog::ContactSheet { .. }+ | Dialog::SlideshowExport { .. }+ | Dialog::Print| Dialog::NewAlbum { .. }| Dialog::NewSmartAlbum { .. }| Dialog::SmartRules { .. }@@@ -1845,7 -1698,7 +1853,8 @@@ pub fn confirm_dialog(app: &mut Lightcr}),),Dialog::ContactSheet { options } => app.run("app.contactSheet", json!(options)),+ Dialog::SlideshowExport { settings } => app.run("app.slideshowExport", json!(settings)),+ Dialog::Print => app.run("app.print", json!({})),Dialog::CopySettings { groups } => app.run("develop.copy", json!({"groups": groups})),Dialog::PasteSettings { groups } => app.run("develop.paste", json!({"groups": groups})),Dialog::Export { opts, full_size, resize, limit_kb, dir, .. } => {diff --cc crates/ui-egui/src/state.rsindex 09c5bf4a1,1be46474b..ccdded8bb--- a/crates/ui-egui/src/state.rs+++ b/crates/ui-egui/src/state.rs@@@ -935,13 -771,9 +938,16 @@@ pub struct NameEdit#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]#[serde(tag = "kind", rename_all = "camelCase")]pub enum Dialog {+ /// A Lightroom import result stays readable after its activity row disappears.+ LightroomResult {+ summary: String,+ library: Option<String>,+ details: Vec<String>,+ first: Option<u64>,+ },+ /// File ▸ Print…: the Print module. Its state is the session's (`print.*`); the page on show+ /// and the selected cell are [`UiState::print`].+ Print,ContactSheet {options: lightcraft_engine::contact_sheet::Options,},@@@ -1356,12 -1146,9 +1362,13 @@@ impl Default for UiStatereference: None,toast: None,last_find_missing: None,+ last_find_missing_result: None,+ #[cfg(test)]+ find_missing_test_delay: None,+ rechecked_library: None,status: String::new(),dialog: None,+ print: Default::default(),}}}diff --cc docs/gaps.mdindex 68c2595e2,c44e928d1..db33e934e--- a/docs/gaps.md+++ b/docs/gaps.md@@@ -1,6 -1,6 +1,6 @@@# Gaps: where LightCraft falls short of Lightroom- > **Last reviewed:** 2026-10-11 · **Last updated:** 2026-10-14 · **Change:** minor (catalog import result, offline Local promotion and reduced copies; gap 8: Nikon Z 6II / Z 8 / Z f in-file distortion; gaps 10, 22 and 23 listed once again: merges had left two copies of each, and `cargo xtask parity` now fails on a gap listed twice)-> **Last reviewed:** 2026-10-11 · **Last updated:** 2026-10-12 · **Change:** minor (gap 15: printer colour management; gap 15: print layout model; gap 10: Leica Q3 verified, 236 models; CR3 entry names the EOS R7 C-RAW fix and the refused CRX variants; CI and Windows / Linux entries note the 0.6.0 riscv64 build; camera colour: tone curve from black-and-white camera JPEGs; Compare and Reference get sharp zoom windows; gap 4 shrinks; gap 14: the HDR switch is read from crs XMP; gaps 2 and 10: EOS R5 Mark II CR3 verified) · **Target:** Adobe Lightroom Classic 15.5 / Lightroom 9.6++> **Last reviewed:** 2026-10-11 · **Last updated:** 2026-10-14 · **Change:** minor (catalog import result, offline Local promotion and reduced copies; gap 8: Nikon Z 6II / Z 8 / Z f in-file distortion; gaps 10, 22 and 23 listed once again: merges had left two copies of each, and `cargo xtask parity` now fails on a gap listed twice; gap 15: Print module with printer colour management)Every known shortfall, one entry each, ranked by user impact (how many Lightroom users hit it, andhow hard it blocks them), then by effort. **Agents pick work from the top** (the first entry nobody is@@@ -22,14 -22,15 +22,14 @@@ Hours are Opus 5.5 agent wall-clock hou| 5 B | **AI masks: Subject, Sky, People, Background, Landscape** are heuristics; Object / Describe run SAM 3 but its download has no mirror configured | `crates/segment`; ai-masks.md; MASK rows 67% | masking is how most Lightroom users edit today | 40–70 + model decision | [target-app-parity](target-app-parity.md#ai) || 6 B | **Compressed ORF** (every Olympus / OM body since ~2008) | measured: 66 of 78 Olympus / OM models preview-only; `orf.rs` refuses; OM bucket 3% of photographers, 3% of them fully work | +2.6 points; best gain per hour of any raw gap (~0.2) | 8–15 | [raw-parity](raw-parity.md#compressed-orf-a-clean-room-starting-point) (the two Olympus patents that describe the method) || 7 | **Nikon High Efficiency NEF** (HE / HE★ on Z 8, Z 9, Z 6III, Z f, Z50II, Z5II when set to HE) | named and preview only (#193); needs a pure-Rust JPEG XS decoder | +1.1 points (only shots taken in HE; lossless works on the same bodies); low gain per hour (~0.04), so not a beta blocker | 20–40 | [raw-parity](raw-parity.md) |-| 8 B | **No lens profile database** (LR-EDIT-OPTICS-PROFILE): only DNG opcodes, RW2 in-file distortion and Sony ILCE-7RM4A distortion | Adobe ships 3,635 lens profiles; we never use them | distortion / vignetting correction is a default step for many | 40–80 + calibration shots | [raw-parity](raw-parity.md#lens-profiles) |+| 8 B | **No lens profile database** (LR-EDIT-OPTICS-PROFILE): only DNG opcodes, RW2 in-file distortion, Sony ILCE-7RM4A and ILCE-7RM6 distortion (`docs/sony-ilce7rm6-lens-corrections.md`) and Nikon Z 6II / Z 8 / Z f distortion (`docs/nikon-lens-corrections.md`) | Adobe ships 3,635 lens profiles; we never use them | distortion / vignetting correction is a default step for many | 40–80 + calibration shots | [raw-parity](raw-parity.md#lens-profiles) || 9 B | **Tests don't run in CI on macOS, Windows or Linux x64**: only FreeBSD runs `cargo test`; the others build packages | `.github/workflows/` (freebsd, packaging-lint, release, windows-arm64); the linux-riscv64 release job added in 0.6.0 (#844) runs only `lightcraft-cli --version` under QEMU | regressions reach users on the main platforms; `cargo xtask ci` runs only locally | 6–12 | [target-app-parity](target-app-parity.md#by-dimension) |-| 10 B | **Per-model verification thin, plus cheap per-body decode fixes**: 236 of 1,446 Adobe models verified (16%), ~42% of photographers on a verified body; Nikon 5 bodies verified, Canon 12, Leica 14 (the Q3 by a recorded check of 38 private DNGs). Cheap fixes: Z 6II packed 14-bit NEF (#769, PR #671), Sony A100 / F828 regression (#702), DSLR-A200…A390 / A850 12-bit ARW (#535) | measured: [raw/coverage.tsv](raw/coverage.tsv) | per-body bugs (levels, crops, WB) surface only from users | 25–45 | [raw-parity](raw-parity.md#by-maker-measured) |-| 10 B | **Per-model verification thin, plus cheap per-body decode fixes**: 236 of 1,446 Adobe models verified (16%), ~42% of photographers on a verified body; Nikon 5 bodies verified, Canon 12. Cheap fixes: Z 6II packed 14-bit NEF (#769, PR #671), Sony A100 / F828 regression (#702), DSLR-A200…A390 / A850 12-bit ARW (#535) | measured: [raw/coverage.tsv](raw/coverage.tsv) | per-body bugs (levels, crops, WB) surface only from users | 25–45 | [raw-parity](raw-parity.md#by-maker-measured) |+| 10 B | **Per-model verification thin, plus cheap per-body decode fixes**: 259 of 1,446 Adobe models verified (18%), ~59% of photographers on a verified body; Nikon 5 bodies verified, Canon 34, Leica 14 (the Q3 by a recorded check of 38 private DNGs). Cheap fixes: Z 6II packed 14-bit NEF (#769, PR #671), Sony A100 / F828 regression (#702), DSLR-A200…A390 / A850 12-bit ARW (#535) | measured: [raw/coverage.tsv](raw/coverage.tsv) | per-body bugs (levels, crops, WB) surface only from users | 25–45 | [raw-parity](raw-parity.md#by-maker-measured) || 11 | **Enhance: Raw Details, Super Resolution; AI denoise without shippable weights or X-Trans** | ENH rows 0%; denoise Bayer only, RawNIND weights GPL and opt-in | Fujifilm users get no AI denoise; nobody gets it out of the box | 30–60 + model decision | [raw-parity](raw-parity.md#demosaic-levels-crops-and-lens-metadata) || 12 | **Content-aware / generative remove, detect distractions, reflections removal** | REM rows 75%; patch synthesis missing | cleanup work goes back to Photoshop | 25–45 (+ generative model) | [target-app-parity](target-app-parity.md#ai) |-| 13 | **Lightroom catalog migration is one-way and approximate**: unsupported Adobe profiles / AI settings archived, history kept as data | lightroom-catalog-import.md | switching users lose some looks | 8–12 | [file-format-parity](file-format-parity.md) |+| 13 | **Lightroom catalog migration is one-way and approximate**: unsupported Adobe profiles / AI settings archived, history kept as data; offline record counts and destination are now shown in a lasting import result | lightroom-catalog-import.md | switching users lose some looks | 8–12 | [file-format-parity](file-format-parity.md) || 14 | **HDR display** (EDR / Windows HDR); the headroom limit and SDR rendition from `crs` XMP (the HDR switch, `HDREditMode`, is read). HLG AVIF export done; the display's SDR/HDR decision is tested, blocked on eframe's 8-bit surface | HDR rows 70%; LR-VIEW-HDR-DISPLAY ⬜ | HDR editing works blind on HDR monitors | 12–25 | [hardware-parity](hardware-parity.md) |- | 15 | **Print module**: custom packages, printer colour management (contact-sheet PDF only) | LRC-PRINT rows | Classic users who print | 25–40 | [target-app-parity](target-app-parity.md#features) |+ | 15 | **Print module**: identity plate / watermark / page numbers / crop marks / photo info overlays, Custom Package Auto Layout, printer-driver Page Setup and direct printing, JPEG file output (the Print dialog writes a colour-managed PDF) | LRC-PRINT rows | Classic users who print | 15–25 | [target-app-parity](target-app-parity.md#features) || 16 | **Map view, Book, Slideshow module, publish services** | LRC-MAP / BOOK / SS rows ⬜ | Classic users; publish services matter for Flickr / SmugMug workflows | 60–100 | [target-app-parity](target-app-parity.md#features) || 17 | **Tethered capture** | ⬜ | studio photographers | 25–45 + cameras | [hardware-parity](hardware-parity.md) || 18 | **Video**: playback, trim, global edits, export | VID rows 0% | users who mix stills and clips | 25–45 | [target-app-parity](target-app-parity.md#features) |@@@ -93,11 -83,11 +93,16 @@@ Beta-blocking gaps (B) total **~230–4| 2026-10-12 | minor | Gap 25: Render to DNG lands as an export format; lossy DNG and AVIF import remain || 2026-10-12 | minor | Gap 10 shrinks: the Hasselblad Lunar (a Sony NEX-7 ARW under its own Make) decodes and is verified, 236 models (#1275) || 2026-10-12 | minor | Gap 14: HLG AVIF export (`hdrTransfer`) and a tested SDR/HDR display decision |+ | 2026-10-12 | minor | Gap 15: printer colour management lands (printer / paper ICC profiles or Managed by Printer, intent, black point compensation, print adjustment, print sharpening, 16-bit ICC-tagged PDF with an output intent); page overlays and direct printing remain |+ | 2026-10-12 | minor | Gap 15 shrinks: File → Print… is a Print dialog with the four layout styles, cell editing, image settings, guides, page setup and templates; printer colour management, page overlays and direct printing remain |+ | 2026-10-12 | minor | Gap 15: the Print module's layout styles, cells, image settings, templates and PDF are `print.*` commands (CLI, control, MCP); the Print view, printer colour management and page overlays remain |+ | 2026-10-12 | minor | Gap 15: print pages compose in the engine (fit / Zoom to Fill, Rotate to Fit, border, stroke, background) with an interim PDF writer; commands and UI still to land |+ | 2026-10-12 | minor | Gap 15: the Print layout model (paper sizes, margins, grid, package cells, Auto Layout packer, snapping) is in the engine; commands, composition and UI still to land |+| 2026-10-12 | minor | Gap 25: lossy DNG export (DNG compression 34892) lands; AVIF import and Render to DNG as a catalog command remain |+| 2026-10-12 | minor | Gap 22: pen pressure scales brush size and flow (Brush ▸ Pen Pressure) where winit reports a pen force |+| 2026-10-12 | minor | Gaps 2 and 10 shrink: 22 more CR3 bodies verified on one CC0 file each (every CC0 CR3 on raw.pixls.us decodes), EOS R6 Mark III white balance read; Canon 34 verified, 259 models, ~59% on a verified body; CR3 gain +6.2 → +0.3 points |+| 2026-10-12 | minor | Gap 10 shrinks: 117 Nikon and Fujifilm bodies verified on one CC0 file each (354 models, ~58% on a verified body); COOLPIX 5700 / 8400 / 8800 decode wrongly; #702 is fixed |+| 2026-10-11 | minor | Nikon edge bars on bodies without CropArea fixed for 36 model / size / depth groups (#976, #914; [nikon-bodies.md](nikon-bodies.md)); gap 10 notes the survey and the pending bodies; gap not closed || 2026-10-11 | minor | Reviewed against main after 0.6.0: CR3 entry names the CRX variants `crx.rs` still refuses and the R7 / R6 Mark II C-RAW state (decoding, not verified, so the measured numbers don't move); CI and Windows / Linux entries note the riscv64 release build (#844); R7 fix added to Closed recently. Panel docking (UI.9, #869) closes no listed gap || 2026-10-11 | minor | Camera colour entry: raws with a black-and-white camera JPEG take its tone curve (#577); gap not closed || 2026-10-11 | minor | Gap 4: Compare and Reference views get zoom windows per pane (1:1 was a 2,560 px render magnified); overlays and soft proofing remain, 8–15 h → 4–8 h |diff --cc docs/parity-checklist.mdindex ee05a4f55,0af3d56bf..8baf1d3d4--- a/docs/parity-checklist.md+++ b/docs/parity-checklist.md@@@ -1,8 -1,6 +1,8 @@@# Lightroom parity checklist- > **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-14 · **Change:** minor (catalog import: persistent result, offline Local promotion and library-switch dismissal; integration batch 35: KEYC-SELECTONLYACTIVE, Select Only Active Photo ⌘⇧D; LR-BEHAV-AUTOSAVE, damaged snapshots repaired on open; LR-EDIT-OPTICS-PROFILE, Nikon Z 6II / Z 8 / Z f in-file distortion; LRC-LIB-CATALOG-IMPORT, WAL-only catalogs open; LR-EXP-DIM, enlargements stop at 512 MP; LR-IMP-CAMERA-COVERAGE, Canon EOS RP CR3 verified; model folder retry) · **Target:** Adobe Lightroom Classic 15.5 / Lightroom 9.6-> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-13 · **Change:** minor (LRC-PRINT-JOB: print colour management and ICC-tagged print PDFs; LRC-PRINT-GUIDES and the other print rows: the Print dialog (File → Print…); LRC-PRINT-LAYOUTSTYLE, LRC-PRINT-CELLS, LRC-PRINT-TEMPLATES and the other print rows: `print.*` commands; LRC-PRINT-IMAGESETTINGS: print page composition (fit / Zoom to Fill, Rotate to Fit, border, stroke, background); LRC-PRINT-LAYOUT: print layout model; LR-MERGE-HDR: merges of raws without colour matrices keep their colour (#965); rapid slider entry; LR-PROF-CAMERACOLOR: tone curve from black-and-white camera JPEGs; LR-VIEW-ZOOM, LR-VIEW-COMPARE: Compare and Reference zoom windows; LR-IMP-FORMATS, LR-IMP-CAMERA-COVERAGE: EOS R5 Mark II CR3 decodes; renamed from `parity.md`; Top gaps moved to gaps.md, shortcut notes to ui-parity.md; filesystem history retry/Undo/Redo evidence; renamed from `parity.md`; Top gaps moved to gaps.md, shortcut notes to ui-parity.md) · **Target:** Adobe Lightroom Classic 15.5 / Lightroom 9.6++> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-14 · **Change:** minor (LRC-PRINT-JOB: print colour management and ICC-tagged print PDFs; LRC-PRINT-* rows: the Print dialog (File → Print…); catalog import: persistent result, offline Local promotion and library-switch dismissal; integration batch 35: KEYC-SELECTONLYACTIVE, Select Only Active Photo ⌘⇧D; LR-BEHAV-AUTOSAVE, damaged snapshots repaired on open; LR-EDIT-OPTICS-PROFILE, Nikon Z 6II / Z 8 / Z f in-file distortion; LRC-LIB-CATALOG-IMPORT, WAL-only catalogs open; LR-EXP-DIM, enlargements stop at 512 MP; LR-IMP-CAMERA-COVERAGE, Canon EOS RP CR3 verified; model folder retry) · **Target:** Adobe Lightroom Classic 15.5 / Lightroom 9.6+> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-14 · **Change:** minor (integration batch 35: KEYC-SELECTONLYACTIVE, Select Only Active Photo ⌘⇧D; LR-BEHAV-AUTOSAVE, damaged snapshots repaired on open; LR-EDIT-OPTICS-PROFILE, Nikon Z 6II / Z 8 / Z f in-file distortion; LRC-LIB-CATALOG-IMPORT, WAL-only catalogs open; LR-EXP-DIM, enlargements stop at 512 MP; LR-IMP-CAMERA-COVERAGE, Canon EOS RP CR3 verified; model folder retry; LR-IMP-FORMATS: preview-only raws rechecked after an update, #662) · **Target:** Adobe Lightroom Classic 15.5 / Lightroom 9.6+> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-12 · **Change:** minor (LR-VIEW-ZOOM: full-size slider-drag drafts on the GPU, timed with their frame, issue #330; rapid slider entry; LR-PROF-CAMERACOLOR: tone curve from black-and-white camera JPEGs; LR-VIEW-ZOOM, LR-VIEW-COMPARE: Compare and Reference zoom windows; LR-IMP-FORMATS, LR-IMP-CAMERA-COVERAGE: EOS R5 Mark II CR3 decodes; renamed from `parity.md`; Top gaps moved to gaps.md, shortcut notes to ui-parity.md; filesystem history retry/Undo/Redo evidence; renamed from `parity.md`; Top gaps moved to gaps.md, shortcut notes to ui-parity.md) · **Target:** Adobe Lightroom Classic 15.5 / Lightroom 9.6The measured, row-by-row checklist: one row per Lightroom feature, menu item and shortcut, what wehave and what is missing. It answers *does the feature exist?* (feature breadth). Whether it is good@@@ -38,7 -36,7 +38,7 @@@ cited here still exists. Formerly docs/| H. Crop & rotate (CROP) | 9 | 0 | 0 | 1 | 6/6 (100%) | 3/3 (100%) || I. Remove / healing (REM) | 8 | 1 | 2 | 2 | 4/4 (100%) | 2/3 (67%) || J. Red eye (EYE) | 2 | 0 | 0 | 0 | — | 1/1 (100%) |--| K. Masking (MASK) | 14 | 5 | 5 | 0 | 7/8 (88%) | 6/6 (100%) |++| K. Masking (MASK) | 15 | 5 | 5 | 0 | 7/8 (88%) | 7/7 (100%) || L. Presets (PRE) | 6 | 0 | 1 | 1 | 2/2 (100%) | 2/2 (100%) || M. Versions & history (VER) | 5 | 0 | 0 | 0 | 1/1 (100%) | 3/3 (100%) || N. Copy / paste / sync (SYNC) | 5 | 0 | 0 | 0 | 3/3 (100%) | 1/1 (100%) |@@@ -51,13 -49,13 +51,13 @@@| U. Map & location (MAP) | 0 | 1 | 1 | 0 | — | 0/1 (0%) || V. Preferences (PREF) | 6 | 2 | 2 | 2 | 1/1 (100%) | 4/5 (80%) || W. Cloud & AI infrastructure (CLOUD / AI) | 1 | 0 | 1 | 2 | — | — |- | X. Cross-cutting behaviours (BEHAV) | 23 | 7 | 1 | 1 | 8/8 (100%) | 7/10 (70%) |+ | X. Cross-cutting behaviours (BEHAV) | 23 | 6 | 1 | 1 | 8/8 (100%) | 7/10 (70%) || Y. Menus | 84 | 0 | 4 | 8 | 47/47 (100%) | 23/23 (100%) |- | Z. Keyboard shortcuts (desktop) | 76 | 4 | 3 | 1 | 49/52 (94%) | 23/25 (92%) |- | Lightroom Classic extras | 36 | 22 | 27 | 8 | — | 24/26 (92%) |- | **Total** | 411 | 59 | 64 | 35 | 193/201 (96%) | 146/159 (92%) |-| Z. Keyboard shortcuts (desktop) | 76 | 3 | 3 | 1 | 49/52 (94%) | 23/24 (96%) |-| Lightroom Classic extras | 38 | 16 | 31 | 8 | — | 24/26 (92%) |-| **Total** | 413 | 52 | 68 | 35 | 193/201 (96%) | 146/158 (92%) |++| Z. Keyboard shortcuts (desktop) | 77 | 4 | 2 | 1 | 49/52 (94%) | 23/25 (92%) |++| Lightroom Classic extras | 40 | 23 | 23 | 8 | — | 24/26 (92%) |++| **Total** | 417 | 61 | 59 | 35 | 193/201 (96%) | 147/160 (92%) |- Weighted completion (✅ = 1, 🟡 = ½, 🚫 left out): **82.5%** of 534 in-scope rows — P0 98.0% of 201 · P1 95.0% of 159 · P2 52.9% of 173.-Weighted completion (✅ = 1, 🟡 = ½, 🚫 left out): **82.4%** of 533 in-scope rows — P0 98.0% of 201 · P1 95.3% of 158 · P2 52.3% of 173.++Weighted completion (✅ = 1, 🟡 = ½, 🚫 left out): **83.3%** of 537 in-scope rows — P0 98.0% of 201 · P1 95.0% of 160 · P2 55.7% of 175.<!-- /parity:summary -->## Top gaps and shortcut notes@@@ -748,23 -740,23 +748,23 @@@ From `08-lightroom-classic-extras.md` (| LRC-BOOK-BG | Book backgrounds | P2 | ⬜ | | || LRC-BOOK-VIEWS | Book views | P2 | ⬜ | | || LRC-BOOK-EXPORT | Book export (PDF/JPEG) | P2 | ⬜ | | |-| LRC-SS-TEMPLATES | Slideshow templates | P2 | ⬜ | | |-| LRC-SS-OPTIONS | Slideshow options | P2 | ⬜ | | |-| LRC-SS-LAYOUT | Slideshow layout | P2 | ⬜ | | |-| LRC-SS-OVERLAYS | Slideshow overlays | P2 | ⬜ | | |-| LRC-SS-BACKDROP | Slideshow backdrop | P2 | ⬜ | | |-| LRC-SS-TITLES | Slideshow titles | P2 | ⬜ | | |+| LRC-SS-TEMPLATES | Slideshow templates | P2 | 🟡 | `cmd:slideshow.templates.list`, `cmd:slideshow.templates.apply`, `cmd:slideshow.templates.save`, `cmd:slideshow.templates.update`, `cmd:slideshow.templates.rename`, `cmd:slideshow.templates.delete`, `cmd:slideshow.templates.import`, `cmd:slideshow.templates.export`, `cmd:slideshow.preview`, `path:crates/engine/src/slide_template.rs`, `path:crates/ui-egui/src/panels/slide_templates.rs` | Template Browser at the top of Settings ▸ Slideshow: a template is the Playback (not "prepare previews"), Layout / Options / Backdrop, Overlays and Titles settings as one versioned JSON document. Five built-ins of our own (Plain Black, Gallery Wall, Edge to Edge, Cinema Wide, Shooting Data; no Lightroom names or designs, no image or font files) and the user's own, saved as files in `<settings>/slideshow-templates` (machine-wide, like Classic's): save current settings, Update with Current Settings, rename, delete (confirmed), import / export `.json`. Click applies (one step, saved with the library); pointing at one previews it on the selected photo (or the intro / ending) in the live preview without changing anything (`slideshow.preview {template}`). No undo for library preferences: the settings a template replaced stay as "Previous settings" for the session (applying it again goes forward). Every section is read through its settings' own validation (out-of-range values clamped, wrong types or unknown keys refused), files are capped (256 KB, 1000 listed), a newer format version is refused with a message, a bad file is listed as skipped, names are sanitised into file names that can't leave the folder, a missing plate / watermark image or background photo applies with a warning. Missing: the Slideshow module's left-panel browser (it lives in Settings until the module view exists), template folders (New Folder, moving templates between folders), saving a slideshow with a collection, a preview thumbnail inside the browser itself |+| LRC-SS-OPTIONS | Slideshow options | P2 | ✅ | `cmd:slideshow.layout`, `cmd:slideshow.preview`, `path:crates/slideshow/src/compose.rs` | Zoom to Fill Frame (the photo covers its image cell, cropped to it; off: fits inside), Stroke Border (colour, width as a share of the slide's shorter side, drawn around the photo), Cast Shadow (opacity, offset, radius, angle; a blurred offset rectangle under the photo and its stroke). Composed by `lightcraft-slideshow` (CPU, no UI) for playback, the Settings ▸ Slideshow preview and `slideshow.preview`; edited in Settings ▸ Slideshow until the Slideshow module view exists |+| LRC-SS-LAYOUT | Slideshow layout | P2 | 🟡 | `cmd:slideshow.layout`, `cmd:slideshow.preview`, `path:crates/ui-egui/src/panels/slide_layout.rs` | Margins left / right / top / bottom (linked or each on its own; shares of the slide's shorter side, so any screen or output size looks the same), Show Guides, Aspect Preview (Screen, 16:9, 4:3). Missing: the Slideshow module's slide editor — guides are drawn only in the Settings ▸ Slideshow preview and can't be dragged to set the margins; the aspect preview applies to that preview and `slideshow.preview` (playback always fills the screen, as in Classic) |+| LRC-SS-OVERLAYS | Slideshow overlays | P2 | 🟡 | `cmd:slideshow.overlays`, `cmd:slideshow.preview`, `path:crates/engine/src/slide_overlay.rs`, `path:crates/ui-egui/src/panels/slide_overlays.rs` | Identity plate (text with size / colour / opacity, or a PNG / JPEG file with its transparency; render behind image), rating stars (our own vector stars, colour, size), text overlays (up to 16) with tokens (`{file}`, `{caption}`, `{title}`, `{date}`, `{exposure}`, `{shutter}`, `{aperture}`, `{focal}`, `{iso}`, `{camera}`, `{lens}`, `{rating}`, `{copyright}` and the other rename tokens; unknown tags show as typed and are reported), size / colour / opacity and a drop shadow (opacity, offset, radius, angle); each at one of nine anchors of the slide or the photo plus an offset, kept on the slide; the export watermark on the photo. Sizes relative to the slide; drawn by the engine over the composed slide (Inter + craft-fonts CJK, the export watermark's text renderer) for playback, the Settings ▸ Slideshow preview and `slideshow.preview`. Missing: dragging overlays on the slide in a Slideshow module editor, font family / style choice (Inter SemiBold only), the Identity Plate Editor's styled multi-run text, right-to-left reordering (Arabic / Hebrew draw in logical order, and without glyphs in Inter) |+| LRC-SS-BACKDROP | Slideshow backdrop | P2 | ✅ | `cmd:slideshow.layout`, `path:crates/slideshow/src/compose.rs` | Background colour, Color Wash (a gradient from a second colour, full at the side its angle points to, at an opacity), Background Image (a library photo filling the slide at an opacity: "Use selected photo" in Settings ▸ Slideshow, `backgroundImage` in `slideshow.layout`; rendered once and shared by the slides). In the web build the composition runs on the main thread when a worker's render comes back |+| LRC-SS-TITLES | Slideshow titles | P2 | 🟡 | `cmd:slideshow.titles`, `cmd:slideshow.preview`, `path:crates/engine/src/slide_title.rs`, `path:crates/ui-egui/src/panels/slide_titles.rs` | Intro screen and ending screen, each on or off (library preference, `slideshow.titles`; Settings ▸ Slideshow ▸ Titles): a background colour and, centred on it, the identity plate of the Overlays section (its text or image; Add Identity Plate) or the screen's own line of text, in the plate's colour or an override colour, at a scale (height as a share of the slide's shorter side; text wider than the slide shrinks to fit), for its own duration (default: the slide duration). Titles are items of the playback timeline: composed off the UI thread by the same composer at the screen's size, prepared ahead, waited for and faded like slides; the intro plays once before the first photo, the ending after the last photo when repeat is off; random order never moves them; ←/→ step across them; they never change the selection and the control bar shows Intro / End instead of n / N. `slideshow.preview {title}` renders a screen; the Settings preview shows Photo / Intro / Ending. An empty view still refuses to play ("no photos to show"). Missing: Classic's exact behaviour with Repeat on is not verified (we never show the ending, and show the intro only at the start, while repeating), the Identity Plate Editor's styled text (Inter SemiBold only), override colour leaves an image plate's colours alone, the Slideshow module's Titles panel (settings live in Settings ▸ Slideshow). Slideshow export (LRC-SS-EXPORT) includes them: a PDF page / JPEG each, and in video they hold and fade like slides || LRC-SS-MUSIC | Slideshow music | P2 | ⬜ | | |-| LRC-SS-PLAYBACK | Slideshow playback | P2 | ⬜ | | |-| LRC-SS-EXPORT | Slideshow export | P2 | ⬜ | | |+| LRC-SS-PLAYBACK | Slideshow playback | P2 | 🟡 | `cmd:slideshow.playback`, `cmd:view.slideshowOptions`, `cmd:slideshow.togglePause`, `cmd:slideshow.next`, `cmd:slideshow.previous`, `cmd:slideshow.end` | Playback settings (library preference, `slideshow.playback`; Settings ▸ Slideshow, View ▸ Slideshow Options…): slide duration 0.5–120 s, fade 0–10 s (≤ slide; 0 = cut) as a crossfade or through a colour, random order (seeded shuffle, every photo once per pass, a new order each pass), repeat (off: ends after the last slide), prepare previews in advance (the next 2 slides render off the UI thread; a transition never starts before its slide is rendered — the current one is held). Space / ←/→ (cut) / Esc and a control bar (previous, play/pause, next, n / N, end) that shows on pointer movement. Missing: the Slideshow module view and its "preview in the view" (phase 2 of the module plan), music and sync to music (LRC-SS-MUSIC), pan & zoom, manual-advance mode, choosing the screen to play on. Intro and ending screens play as items of the same timeline (LRC-SS-TITLES). Slides are composed with the layout, options and backdrop (LRC-SS-LAYOUT / OPTIONS / BACKDROP) and carry the overlays (LRC-SS-OVERLAYS) |+| LRC-SS-EXPORT | Slideshow export | P2 | 🟡 | `cmd:slideshow.export`, `cmd:slideshow.exportStatus`, `cmd:dialog.slideshowExport`, `cmd:app.slideshowExport`, `path:crates/engine/src/slideshow_export.rs`, `path:crates/codecs/src/video.rs`, `path:crates/ui-egui/src/slideshow_export.rs` | View ▸ Export Slideshow… (and Export PDF / JPEG / Video in Settings ▸ Slideshow): the photos in view as their composed slides (layout, overlays) between the intro and ending screens that are on, in view order. **PDF**: one page per slide at 1024 / 1920 / 3840 px (any 64–8192 by command; page = slide pixels in points, aspect from the aspect preview, "screen" = 16:9), JPEG quality, each page carrying the slide duration and a fade transition for presentation mode, "Automatically show full screen" (`/PageMode /FullScreen`). **JPEG**: `<name>-001.jpg`… in a new folder. **Video**: AV1 (rav1e, fast preset) in MP4 or WebM written by our own muxers, 720p / 1080p (64–2160 by command), 24 / 30 fps (25 / 60 by command); each slide held for its duration (one long sample: variable frame rate) and fades rendered as blended frames (crossfade or through the fade colour); at most 2 hours. Runs in the background with a row in the activity stack (frames or slides done, ✕ cancels); files are written as `.part` and renamed when complete, so a cancelled or failed export leaves nothing; a photo that can't be rendered is skipped with a warning. Missing: H.264 (Classic's codec; patents, no pure-Rust encoder), audio / music in the video (LRC-SS-MUSIC), random order and pan & zoom in exports, the PDF's per-page fades follow the viewer (Acrobat), export presets, Classic's export dialog sizes beyond these, the web build (no export) |- | LRC-PRINT-LAYOUTSTYLE | Print layout styles | P2 | 🟡 | `cmd:dialog.contactSheet`, `cmd:export.contactSheet`, `crates/engine/src/contact_sheet.rs` | paginated contact sheets; single-image/custom package layouts missing |- | LRC-PRINT-IMAGESETTINGS | Print image settings | P2 | ⬜ | | |- | LRC-PRINT-LAYOUT | Print layout | P2 | 🟡 | `cmd:export.contactSheet`, `crates/ui-egui/src/panels/dialogs.rs` | A4/Letter, portrait/landscape, 1–8 columns and 1–10 rows; fixed margins and spacing |- | LRC-PRINT-GUIDES | Print guides | P2 | ⬜ | | |- | LRC-PRINT-CELLS | Picture-package cells | P2 | ⬜ | | |- | LRC-PRINT-PAGE | Print page options | P2 | 🟡 | `cmd:export.contactSheet`, `crates/engine/src/contact_sheet.rs` | optional filename captions; no page backgrounds/identity plates |- | LRC-PRINT-JOB | Print job & colour management | P2 | 🟡 | `cmd:export.contactSheet`, `cmd:app.contactSheet`, `crates/ui-egui/src/export_task.rs` | PDF export at fixed 150 dpi in sRGB, current edits, background progress/cancel and original protection; no native printer integration, ICC soft proof/print profiles or selectable resolution |- | LRC-PRINT-TEMPLATES | Print templates | P2 | ⬜ | | |+ | LRC-PRINT-LAYOUTSTYLE | Print layout styles | P2 | ✅ | `cmd:dialog.print`, `cmd:print.set`, `cmd:print.get`, `cmd:print.exportPdf`, `cmd:export.contactSheet`, `crates/ui-egui/src/print_view.rs` | File → Print… (⌘P): Single Image, Contact Sheet, Picture Package and Custom Package, one page preview each; also `print.*` commands for the CLI, control channel and MCP; the older File → Contact Sheet PDF stays |+ | LRC-PRINT-IMAGESETTINGS | Print image settings | P2 | ✅ | `cmd:print.set`, `crates/engine/src/print/compose.rs`, `crates/ui-egui/src/print_view.rs` | Zoom to Fill Frame, Rotate to Fit, Photo Border (width, colour; package styles) and Inner Stroke (width in points, colour) in the dialog, drawn in the preview and in the PDF; pixel-tested |+ | LRC-PRINT-LAYOUT | Print layout | P2 | 🟡 | `cmd:print.set`, `cmd:print.layout.autoLayout`, `cmd:print.layout.newPage`, `cmd:print.layout.clear`, `cmd:app.print`, `cmd:export.contactSheet`, `crates/engine/src/print/layout.rs` | A3/A4/A5/Letter/Legal/Tabloid/4x6/5x7/8x10/13x19 and custom paper, portrait/landscape, per-side margins, grid with column/row spacing and square cells, 72–720 ppi, in a Print dialog with a scaled page preview; no printer-driver Page Setup, no cell size / alignment presets |+ | LRC-PRINT-GUIDES | Print guides | P2 | ✅ | `cmd:print.set`, `cmd:print.cell.move`, `crates/ui-egui/src/print_view.rs` | rulers in in/cm/mm/pt, snap off/cells/grid with a grid size, and Page Margins / Page Bleed (a fixed 0.125 in outline) / Page Grid / Image Cells / Dimensions guides drawn on the preview |+ | LRC-PRINT-CELLS | Picture-package cells | P2 | ✅ | `cmd:print.cell.add`, `cmd:print.cell.move`, `cmd:print.cell.resize`, `cmd:print.cell.delete`, `cmd:print.cell.stack`, `cmd:print.cell.photo`, `cmd:print.cell.page`, `cmd:print.layout.autoLayout`, `crates/ui-egui/src/print_view.rs` | add cells at standard or custom sizes, drag and resize them on the page preview (snap to cells, grid or off), Send to Back / Backward / Forward / Bring to Front, a photo per cell (Custom Package), Auto Layout packing, New Page, Clear Layout; no Auto Layout for Custom Package |+ | LRC-PRINT-PAGE | Print page options | P2 | 🟡 | `cmd:print.set`, `cmd:export.contactSheet`, `crates/engine/src/print/compose.rs`, `crates/ui-egui/src/print_view.rs` | page background colour and margins in the Print dialog; filename captions in the contact-sheet PDF; no identity plate, watermark, page numbers, crop marks or photo info |+ | LRC-PRINT-JOB | Print job & colour management | P2 | 🟡 | `cmd:print.set`, `cmd:print.exportPdf`, `crates/ui-egui/src/print_view.rs`, `crates/engine/src/print_color.rs`, `crates/codecs/src/print.rs`, `crates/engine/src/pdf.rs`, `cmd:export.contactSheet` | the Print dialog's Print Job panel and `print.set {job}`: print resolution 72–720 ppi; colour management: Managed by Printer (sRGB / Adobe RGB, profile embedded) or a printer / paper ICC profile (RGB, CMYK or grey) converted here and named as the PDF's output intent; perceptual / relative colorimetric with black point compensation; Print Adjustment brightness / contrast; print sharpening Low / Standard / High for Matte / Glossy; 16-bit (or 8-bit) ICC-tagged lossless page images; a bad profile fails before rendering (`tests_print::export_pdf_with_a_printer_profile`). The contact sheet keeps its fixed 150 dpi sRGB JPEG PDF. Missing: printing to a printer (OS print dialog), JPEG file output, Draft Mode |+ | LRC-PRINT-TEMPLATES | Print templates | P2 | 🟡 | `cmd:print.template.save`, `cmd:print.template.apply`, `cmd:print.template.list`, `cmd:print.template.delete`, `crates/ui-egui/src/print_view.rs` | save, apply and delete named templates (layout, image settings, page, job) at the top of the Print dialog, kept with the library; no built-in templates, no folders, no import / export of template files || LRC-WEB-LAYOUT | Web gallery layouts | OOS | 🚫 | | || LRC-WEB-SITEINFO | Web gallery site info | OOS | 🚫 | | || LRC-WEB-COLOR | Web gallery colours | OOS | 🚫 | | |@@@ -837,20 -806,12 +837,26 @@@ Latin stays upright. Advanced Japanese| 2026-10-12 | minor | LR-IMP-FORMATS: the Hasselblad Lunar (a Sony NEX-7 ARW under Make HASSELBLAD) decodes from sensor data instead of opening as its preview; an uncompressed Leaf MOS imports as a preview-only raw instead of a greyscale image of its mosaic (#1275); status unchanged (🟡) || 2026-10-12 | minor | LR-HDR-EXPORT, LR-EXP-HDR: HLG AVIF export (`hdrTransfer`); LR-VIEW-HDR-DISPLAY: tested SDR/HDR display decision || 2026-10-12 | minor | LR-EXP-PSD, MENU-FILE-PHOTOSHOP: Photo ▸ Edit In ▸ Open Original in Other Editor (RAW, no copy) hands the original files (the raws themselves) to the other editor in one start; statuses unchanged |+ | 2026-10-12 | minor | LRC-PRINT-JOB: the Print dialog's Print Job panel sets the profile (Managed by Printer or a printer / paper profile picked from disk), intent, black point compensation, print adjustment, print sharpening and depth |+ | 2026-10-12 | minor | LRC-PRINT-JOB: print colour management (printer / paper ICC profiles or Managed by Printer, intent, black point compensation, print adjustment, print sharpening) and a 16-bit ICC-tagged PDF with an output intent; still 🟡 (no OS print dialog or JPEG output) |+ | 2026-10-12 | minor | LRC-PRINT-GUIDES, LRC-PRINT-CELLS, LRC-PRINT-LAYOUTSTYLE, LRC-PRINT-IMAGESETTINGS (✅), LRC-PRINT-LAYOUT, LRC-PRINT-PAGE, LRC-PRINT-TEMPLATES (🟡): File → Print… opens the Print dialog with a scaled page preview, rulers and guides, cells dragged and resized with snapping, image settings, page setup and templates, and prints to PDF in the background |+ | 2026-10-12 | minor | LRC-PRINT-LAYOUTSTYLE, LRC-PRINT-IMAGESETTINGS, LRC-PRINT-LAYOUT, LRC-PRINT-CELLS, LRC-PRINT-PAGE, LRC-PRINT-TEMPLATES: the Print module is reachable as 18 `print.*` commands (settings, cells, Auto Layout, PDF, templates saved in prefs.json) from the CLI, control channel and MCP; 🟡 until the Print UI lands, LRC-PRINT-GUIDES stays ⬜ |+ | 2026-10-12 | minor | LRC-PRINT-IMAGESETTINGS: `print/compose.rs` composes pages (Zoom to Fill, Rotate to Fit, Photo Border, Inner Stroke, background) from the layout model into 16-bit Rec. 2020 `PageRaster`s, with an interim sRGB PDF writer in `print/output.rs`; rows stay until commands and UI reach them |+ | 2026-10-12 | minor | LRC-PRINT-LAYOUT: the Print layout model (paper, margins, grid, package cells, Auto Layout packer, snapping) lands in `print/layout.rs`; no row changes status until commands and UI follow |+| 2026-10-12 | minor | LR-MASK-BRUSH: pen pressure scales brush size and flow |+| 2026-10-13 | patch | LR-BEHAV-AUTOSAVE: a damaged snapshot that still parses is repaired on open (ids, stacks, folder loops, id counters) instead of panicking or hanging; status unchanged |+| 2026-10-13 | minor | LR-EDIT-OPTICS-PROFILE: Nikon Z 6II / Z 8 / Z f NEFs use the camera's in-file distortion correction (NikonNEFInfo); status unchanged (🟡) |+| 2026-10-12 | minor | LR-IMP-FORMATS and LR-IMP-CAMERA-COVERAGE: 22 more CR3 bodies verified on one CC0 file each (all 110 CC0 CR3s decode); EOS R6 Mark III `ColorData` 66 white balance; status unchanged (🟡: CRX variants without public samples remain refused) |+| 2026-10-11 | minor | Model setup folder action, opener error and retry (LR-MASK-OBJECTS). |+| 2026-10-12 | minor | LR-VIEW-ZOOM: slider-drag drafts are timed with the frame that shows them, drop to 0.6 mid-drag when far over budget, stay 0.6 under a zoom window; workers convert texture pixels (issue #330); status unchanged |+| 2026-10-11 | minor | LR-VIEW-ZOOM: a slider drag keeps the loupe's full resolution where the GPU draws the view and keeps up (0.6 drafts on the CPU, with soft proofing or the HDR range, or after over-budget drags; issue #330); status unchanged |+| 2026-10-11 | minor | LR-EXP-LOCATION: Export to "Same folder as original photo" (`destinationMode`), issue #956; status unchanged (✅) |+| 2026-10-12 | minor | LR-IMP-CAMERA-COVERAGE: 117 Nikon and Fujifilm Adobe models verified on one CC0 file each; COOLPIX 5700 / 8400 / 8800 found decoding wrongly; status unchanged (🟡) |+| 2026-10-13 | patch | LR-EXP-QUALITY: JPEG exports use Huffman tables made for each image (same pixels, 12–14 % smaller files, issue #1373); status unchanged |+| 2026-10-13 | patch | LR-BEHAV-GPU: a GPU lost while LightCraft runs (driver reset) is reported as a stop, not a failed start, and the next start renders on the CPU and says why (issue #1337); status unchanged |+| 2026-10-13 | minor | LR-META-INFO: Nikon DSLR raws show their lens from the maker note; status unchanged (✅) |+| 2026-10-13 | patch | LR-IMP-LOCAL: browsing a Local folder again forgets the untouched records of files deleted or moved by another app (issue #1392); status unchanged |+| 2026-10-13 | minor | LR-MERGE-PANO: a panorama keeps its photos' resolution (up to 512 MP / 65,000 px) instead of a fixed 40 MP, held to what fits in memory (issue #1455); status unchanged || 2026-10-11 | minor | KEY-SLIDER-TYPE: honor immediate Return/Escape and keep typed keys in the value editor; add regression references || 2026-10-11 | minor | LR-PROF-CAMERACOLOR: raws with a black-and-white camera JPEG take its tone curve (issue #577) || 2026-10-11 | minor | LR-VIEW-ZOOM and LR-VIEW-COMPARE: Compare and Reference are sharp at 1:1 (zoom windows per pane, two originals kept decoded while they are open); statuses unchanged |