Skip to content

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

Codecs: save Cineon (.cin) film frames

Marco Arnulfob11223b272f4
diff --git a/apps/photocraft/src/services.rs b/apps/photocraft/src/services.rs
index 9de1c475e..09c1f0bcb 100644
--- a/apps/photocraft/src/services.rs
+++ b/apps/photocraft/src/services.rs
@@ -68,6 +68,7 @@ const SAVE_FILTERS: &[(&str, &[&str])] = &[
("OpenEXR", &["exr"]),
("FITS", &["fits", "fit"]),
("DPX", &["dpx"]),
+ ("Cineon", &["cin"]),
];
/// Non-document files the shell saves (Swatches panel exports): offered alone, so the dialog
diff --git a/crates/codecs/README.md b/crates/codecs/README.md
index d4f709489..f897a5841 100644
--- a/crates/codecs/README.md
+++ b/crates/codecs/README.md
@@ -47,7 +47,7 @@ let out = encode(&img, Format::Tiff, &EncodeOptions::default())?;
| Radiance HDR | yes | yes | F32 | RGB | no | no | no | no | no | no | yes (RGBE) | `image` |
| FITS | yes | yes | U8, U16, F32 | Gray, RGB | no | no | no | no | no | yes (header cards) | no | built in |
| DPX | yes | yes | U8, U16 (10/12-bit code values read and written exactly through U16) | Gray, RGB, RGBA | yes | no | no | no | no | DPX header fields only (creator, project, copyright, creation time, transfer, colorimetric, frame position, frame rate, time code) | no | built in |
-| Cineon | yes | **no** | U16 (10-bit code values) | Gray, RGB | no | no | no | no | no | no | n/a | built in |
+| Cineon | yes | yes | U16 (10-bit code values read and written exactly through U16) | Gray, RGB | no | no | no | no | no | no | no | built in |
| AVIF | **no** | only with feature `avif` | U8 | RGB, RGBA | yes | no | no | no | no | no | yes | `image` + `ravif` |
| HEIF/HEIC | with feature `heif` | **no** | U8, U16 (10/12-bit decodes to U16) | RGB, RGBA | yes (auxiliary alpha) | yes (`colr` prof) | yes | yes | no | no | n/a | `heic-rs` |
@@ -96,13 +96,18 @@ embedded table (and a PNG's transparent entry) so `photocraft-io` can open them
Other descriptors, signed or run-length-encoded data and other bit depths return
`CodecError::Unsupported` naming the field.
-* **Cineon (read-only).** Kodak's 10-bit logarithmic film-scan format (the one DPX grew from),
+* **Cineon.** Kodak's 10-bit logarithmic film-scan format (the one DPX grew from),
read from the same Kodak header family: the generic 1024-byte header, big-endian, one (Gray)
or three (RGB) channels, three 10-bit samples packed into each 32-bit word, lines on a word
boundary. The 10-bit code values open as U16 `round(c × 65535 / 1023)`; the file's black/white
reference points are a log-conversion choice and are not applied. A depth other than 10 bits or
a channel count other than 1/3 returns `CodecError::Unsupported`; truncation errors rather than
- panicking. There is no Cineon writer (`ASYMMETRIC_EXCEPTIONS`); save as DPX, TIFF or EXR.
+ panicking. Writing follows the Cineon 4.5 layout: a 1024-byte generic header (version `V4.5`,
+ one or three channels designated as universal-metric gray or R, G, B, 10 bits, data 0–1023 over
+ densities 0–2.048) and a 1024-byte film header left undefined, then the samples three to a
+ big-endian 32-bit word, left justified (packing 5), lines on a word boundary. Samples are written
+ as `round(v × 1023 / 65535)`, so a frame opened from Cineon keeps its code values; any other
+ image takes the encode plan (alpha dropped, CMYK and Lab to RGB) and is quantized to 10 bits.
* **Camera raw files** (DNG, CR2, NEF, ARW… which are TIFF-structured) are recognised and refused
with `CodecError::Unsupported`: they are sensor data, not flat images. `photocraft-raw` decodes
diff --git a/crates/codecs/src/codecs/dpx.rs b/crates/codecs/src/codecs/dpx.rs
index 091403d64..f93c79c92 100644
--- a/crates/codecs/src/codecs/dpx.rs
+++ b/crates/codecs/src/codecs/dpx.rs
@@ -21,6 +21,8 @@
//! Writing: one element, big-endian, unencoded, descriptor 6, 50 or 51; 8 and 16 bits with
//! packing 0, 10 and 12 bits with packing 1 (method A). The bit depth follows the image
//! (8 → 8, 16 → 16) unless [`EncodeOptions::dpx_bits`] picks one.
+//!
+//! Kodak Cineon (`.cin`), the format DPX grew from, is read and written here too (see its section).
use crate::Format;
use crate::error::CodecError;
@@ -344,7 +346,7 @@ pub(crate) fn decode(bytes: &[u8], limits: &Limits) -> Result<Image, CodecError>
// orientation (1 byte), the channel count (1 byte) and up to eight 28-byte channel descriptors
// (the first carries the bits per pixel and the line/image dimensions). Image data is three
// 10-bit samples packed into each 32-bit word, lines on a word boundary — the same layout as
-// DPX's 10-bit packing method A, so the unpacking is shared.
+// DPX's 10-bit packing method A, so the unpacking and packing are shared.
/// The Cineon magic number (`802A5FD7` hex), big-endian.
pub(crate) fn is_cineon(b: &[u8]) -> bool {
@@ -409,6 +411,81 @@ pub(crate) fn decode_cineon(bytes: &[u8], limits: &Limits) -> Result<Image, Code
Image::from_u16(width, height, layout, &wide)
}
+/// Cineon's generic plus film header: where our image data starts.
+const CINEON_HEADER_LEN: usize = 2048;
+const CINEON_GENERIC_LEN: u32 = 1024;
+/// Offset of the first of the eight 28-byte channel descriptors.
+const CINEON_CHANNEL0: usize = 196;
+
+/// Encode a Cineon 4.5 frame: the generic header, an undefined film header, then the samples as
+/// 10-bit code values `round(v × 1023 / 65535)`, three to a big-endian word, left justified
+/// (packing 5), lines on a word boundary. The plan has already made the image U16 gray or RGB.
+pub(crate) fn encode_cineon(src: &Image, plan: Plan) -> Result<Vec<u8>, CodecError> {
+ let enc = |msg: String| CodecError::encode(Format::Cineon, msg);
+ let img = src.converted(plan.layout, plan.sample);
+ let (w, h) = img.dimensions();
+ // Channel designators: 0 for black and white, 1–3 for red, green and blue.
+ let designators: &[u8] = match img.layout() {
+ ChannelLayout::Gray => &[0],
+ ChannelLayout::Rgb => &[1, 2, 3],
+ l => return Err(enc(format!("Cineon cannot store {l:?}"))),
+ };
+ let samples = img.to_u16_samples().ok_or_else(|| enc(format!("cannot write {:?} samples at 10 bits", img.sample_type())))?;
+ let codes: Vec<u16> = samples.into_iter().map(|v| narrow(v, 1023)).collect();
+ let per_line = (w as usize).checked_mul(designators.len()).ok_or_else(|| enc("image too large".into()))?;
+ if codes.len() != per_line.checked_mul(h as usize).ok_or_else(|| enc("image too large".into()))? {
+ return Err(enc("the image has the wrong number of samples".into()));
+ }
+ let data_len = line_bytes(per_line, 10, 1).and_then(|l| l.checked_mul(h as usize)).ok_or_else(|| enc("image too large".into()))?;
+ let total =
+ CINEON_HEADER_LEN.checked_add(data_len).and_then(|t| u32::try_from(t).ok()).ok_or_else(|| enc("image too large for a Cineon file (4 GiB)".into()))?;
+
+ let mut wr = Writer { h: vec![0; CINEON_HEADER_LEN] };
+ // File information.
+ wr.u32(0, 0x802A_5FD7);
+ wr.u32(4, CINEON_HEADER_LEN as u32);
+ wr.u32(8, CINEON_GENERIC_LEN);
+ wr.u32(12, CINEON_HEADER_LEN as u32 - CINEON_GENERIC_LEN);
+ wr.u32(16, 0);
+ wr.u32(20, total);
+ wr.string((24, 8), "V4.5");
+ // Image information: default orientation, then each channel's descriptor; the unused ones,
+ // the white point and the primaries are undefined.
+ wr.u8(192, 0);
+ wr.u8(193, designators.len() as u8);
+ wr.undefined(CINEON_CHANNEL0, 420);
+ for (i, &designator) in designators.iter().enumerate() {
+ let c = CINEON_CHANNEL0 + 28 * i;
+ wr.u8(c, 0);
+ wr.u8(c + 1, designator);
+ wr.u8(c + 2, 10);
+ wr.u8(c + 3, 0);
+ wr.u32(c + 4, w);
+ wr.u32(c + 8, h);
+ // Code values 0–1023 stand for printing densities 0–2.048, the Cineon convention. All
+ // four are 32-bit floats here (DPX stores the data values as integers).
+ wr.u32(c + 12, 0f32.to_bits());
+ wr.u32(c + 16, 0f32.to_bits());
+ wr.u32(c + 20, 1023f32.to_bits());
+ wr.u32(c + 24, 2.048f32.to_bits());
+ }
+ // Pixel-interleaved, unsigned, positive, no line or channel padding.
+ wr.u8(681, 5);
+ // Image origination: pixel pitches and gamma unknown.
+ wr.undefined(972, 984);
+ // Film header: manufacturer, type, perforation offset, prefix, count, frame position and rate
+ // unknown; its strings stay empty.
+ wr.undefined(1024, 1036);
+ wr.undefined(1068, 1076);
+
+ let mut out = wr.h;
+ out.try_reserve_exact(data_len).map_err(|_| enc("out of memory".into()))?;
+ for row in codes.chunks_exact(per_line.max(1)) {
+ pack_line(&mut out, row, 10);
+ }
+ Ok(out)
+}
+
/// The kept header fields as text metadata, in [`KEYS`] order; undefined ones are left out.
fn header_text(b: &[u8], o: Order, e: Element) -> Vec<(String, String)> {
let mut text = Vec::new();
diff --git a/crates/codecs/src/format.rs b/crates/codecs/src/format.rs
index fa2e1e6cb..c00ad3880 100644
--- a/crates/codecs/src/format.rs
+++ b/crates/codecs/src/format.rs
@@ -33,7 +33,7 @@ pub enum Format {
Fits,
/// DPX (SMPTE 268M Digital Picture Exchange): luma, RGB or RGBA film and video frames.
Dpx,
- /// Kodak Cineon (`.cin`, the 10-bit film-scan format DPX grew from): read-only.
+ /// Kodak Cineon (`.cin`, the 10-bit film-scan format DPX grew from).
Cineon,
}
@@ -80,11 +80,6 @@ pub const ASYMMETRIC_EXCEPTIONS: &[(Format, &str)] = &[
"AVIF encode uses ravif (pure Rust) but decoding requires dav1d (C); read stays unsupported \
until a pure-Rust AV1 decoder is viable. Only enabled with the non-default `avif` feature.",
),
- (
- Format::Cineon,
- "Cineon frames are imported for film work; this crate has no Cineon writer, so save an \
- imported frame as DPX, TIFF or EXR instead.",
- ),
(
Format::Heif,
"HEIC decode uses heic-rs (pure Rust, in the optional photocraft-heif crate behind the \
@@ -266,7 +261,7 @@ pub fn caps(format: Format) -> FormatCaps {
Format::Fits => FormatCaps { depths: &[S::U8, S::U16, S::F32], layouts: &[L::Gray, L::Rgb], alpha: false, text: true, ..base },
// `text`: the DPX header fields only (see `fidelity_warnings_with`).
Format::Dpx => FormatCaps { depths: &[S::U8, S::U16], layouts: &[L::Gray, L::Rgb, L::Rgba], text: true, ..base },
- Format::Cineon => FormatCaps { read: true, write: false, depths: &[S::U16], layouts: &[L::Gray, L::Rgb], alpha: false, ..base },
+ Format::Cineon => FormatCaps { depths: &[S::U16], layouts: &[L::Gray, L::Rgb], alpha: false, ..base },
}
}
diff --git a/crates/codecs/src/lib.rs b/crates/codecs/src/lib.rs
index 86611599d..4dccf3418 100644
--- a/crates/codecs/src/lib.rs
+++ b/crates/codecs/src/lib.rs
@@ -255,7 +255,7 @@ pub fn encode(image: &Image, format: Format, opts: &EncodeOptions) -> Result<Vec
Format::Dds => Err(CodecError::unsupported(format, "DDS is import-only; save as PNG instead")),
Format::Fits => fits::encode(image, plan, opts),
Format::Dpx => dpx::encode(image, plan, opts),
- Format::Cineon => Err(CodecError::unsupported(format, "Cineon is import-only; save as DPX, TIFF or EXR instead")),
+ Format::Cineon => dpx::encode_cineon(image, plan),
Format::OpenExr => exr::encode(image, plan, opts),
Format::Heif => Err(CodecError::unsupported(format, "encoding is not available in this build")),
Format::Gif | Format::Bmp | Format::Tga | Format::Ico | Format::Qoi | Format::Hdr | Format::Avif => via_image::encode(format, image, plan, opts),
diff --git a/crates/codecs/tests/detect_caps.rs b/crates/codecs/tests/detect_caps.rs
index f2191e05f..312920aeb 100644
--- a/crates/codecs/tests/detect_caps.rs
+++ b/crates/codecs/tests/detect_caps.rs
@@ -60,6 +60,7 @@ fn default_build_formats_all_symmetric() {
Format::Hdr,
Format::Fits,
Format::Dpx,
+ Format::Cineon,
];
for f in expected {
assert!(caps(f).read && caps(f).write, "{f:?}");
@@ -192,8 +193,8 @@ fn detect_magic_cineon() {
b[0..4].copy_from_slice(&[0x80, 0x2A, 0x5F, 0xD7]);
assert_eq!(detect(&b), Some(Format::Cineon));
assert_eq!(from_extension("scan.CIN"), Some(Format::Cineon));
- assert!(caps(Format::Cineon).read && !caps(Format::Cineon).write, "Cineon is read-only");
- assert!(ASYMMETRIC_EXCEPTIONS.iter().any(|(f, _)| *f == Format::Cineon));
+ assert!(caps(Format::Cineon).read && caps(Format::Cineon).write, "Cineon is read and written");
+ assert!(!ASYMMETRIC_EXCEPTIONS.iter().any(|(f, _)| *f == Format::Cineon));
// A bare magic is an error, never a panic.
assert!(decode_as(Format::Cineon, &b).is_err());
}
diff --git a/crates/codecs/tests/dpx.rs b/crates/codecs/tests/dpx.rs
index 8fdeb398c..6fbfb2db7 100644
--- a/crates/codecs/tests/dpx.rs
+++ b/crates/codecs/tests/dpx.rs
@@ -384,3 +384,95 @@ fn unsupported_and_damaged_files_error_instead_of_panicking() {
assert!(decode_as(Format::Dpx, &bytes).is_err(), "{what}");
}
}
+
+// ---------------------------------------------------------------- Cineon (Kodak .cin)
+
+/// A Cineon 4.5 file built field by field: the 1024-byte generic header, a 1024-byte film header,
+/// then `codes` (interleaved, top line first) three 10-bit values to a big-endian word, left
+/// justified, each line on a word boundary.
+fn cineon_bytes(channels: u8, width: u32, height: u32, codes: &[u16]) -> Vec<u8> {
+ let mut b = vec![0u8; 2048];
+ b[0..4].copy_from_slice(&0x802A_5FD7u32.to_be_bytes());
+ b[4..8].copy_from_slice(&2048u32.to_be_bytes());
+ b[193] = channels;
+ b[198] = 10;
+ b[200..204].copy_from_slice(&width.to_be_bytes());
+ b[204..208].copy_from_slice(&height.to_be_bytes());
+ for line in codes.chunks(width as usize * usize::from(channels)) {
+ for chunk in line.chunks(3) {
+ let w = chunk.iter().enumerate().fold(0u32, |w, (i, &c)| w | (u32::from(c) << (22 - 10 * i as u32)));
+ b.extend(w.to_be_bytes());
+ }
+ }
+ b
+}
+
+/// Code values spread over 0..=1023, ends included.
+fn cineon_codes(n: usize) -> Vec<u16> {
+ (0..n).map(|i| if i == 1 { 1023 } else { ((i as u64 * 2654435761) % 1024) as u16 }).collect()
+}
+
+/// Reads back what we wrote: (channels, width, height, code values), from the header's own fields.
+fn cineon_written(b: &[u8]) -> (u8, u32, u32, Vec<u16>) {
+ let off = be32_at(b, 4) as usize;
+ let (nc, w, h) = (b[193], be32_at(b, 200), be32_at(b, 204));
+ let per_line = w as usize * usize::from(nc);
+ let stride = per_line.div_ceil(3) * 4;
+ let mut codes = Vec::new();
+ for y in 0..h as usize {
+ let line = &b[off + y * stride..];
+ codes.extend((0..per_line).map(|i| ((be32_at(line, i / 3 * 4) >> (22 - 10 * (i % 3) as u32)) & 0x3FF) as u16));
+ }
+ (nc, w, h, codes)
+}
+
+#[test]
+fn cineon_frames_saved_as_cineon_keep_their_code_values_and_reopen_identically() {
+ // Widths that leave partly filled words at the end of each line.
+ for (channels, layout) in [(1u8, ChannelLayout::Gray), (3, ChannelLayout::Rgb)] {
+ let codes = cineon_codes(5 * 3 * usize::from(channels));
+ let img = decode(&cineon_bytes(channels, 5, 3, &codes)).unwrap();
+ assert_eq!(img.layout(), layout);
+ let out = encode(&img, Format::Cineon, &EncodeOptions::default()).unwrap_or_else(|e| panic!("{layout:?}: {e}"));
+ assert_eq!(detect(&out), Some(Format::Cineon), "{layout:?}");
+ assert_eq!(cineon_written(&out), (channels, 5, 3, codes), "{layout:?}");
+ assert_eq!(decode(&out).unwrap(), img, "{layout:?}");
+ }
+}
+
+#[test]
+fn cineon_header_follows_the_kodak_layout() {
+ let img = decode(&cineon_bytes(3, 4, 2, &cineon_codes(24))).unwrap();
+ let out = encode(&img, Format::Cineon, &EncodeOptions::default()).unwrap();
+ let f32_at = |at: usize| f32::from_bits(be32_at(&out, at));
+ // Generic and film header lengths, user data, total size, version.
+ assert_eq!((be32_at(&out, 4), be32_at(&out, 8), be32_at(&out, 12), be32_at(&out, 16)), (2048, 1024, 1024, 0));
+ assert_eq!(be32_at(&out, 20) as usize, out.len());
+ assert_eq!(&out[24..29], b"V4.5\0");
+ // Upright, three channels, each the universal metric's red, green, blue at 10 bits.
+ assert_eq!((out[192], out[193]), (0, 3));
+ for (i, colour) in [1u8, 2, 3].into_iter().enumerate() {
+ let c = 196 + 28 * i;
+ assert_eq!(&out[c..c + 3], &[0, colour, 10], "channel {i}");
+ assert_eq!((be32_at(&out, c + 4), be32_at(&out, c + 8)), (4, 2), "channel {i}");
+ // Minimum and maximum data value and quantity, all four 32-bit floats.
+ assert_eq!((f32_at(c + 12), f32_at(c + 16), f32_at(c + 20), f32_at(c + 24)), (0.0, 0.0, 1023.0, 2.048), "channel {i}");
+ }
+ // Pixel interleave, 32-bit words left justified, unsigned, positive, no padding.
+ assert_eq!(&out[680..692], &[0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);
+ // Two lines of twelve samples: four words each.
+ assert_eq!(out.len(), 2048 + 2 * 16);
+}
+
+#[test]
+fn any_image_saves_as_ten_bit_cineon() {
+ // 16-bit samples land on the nearest 10-bit code; colour with alpha drops it, gray stays gray.
+ let wide = Image::from_u16(3, 1, ChannelLayout::Rgba, &[0, 32, 65535, 65535, 30000, 40000, 50000, 0, 1, 2, 3, 4]).unwrap();
+ let out = encode(&wide, Format::Cineon, &EncodeOptions::default()).unwrap();
+ let to_code = |v: u16| (f64::from(v) * 1023.0 / 65535.0).round() as u16;
+ let want: Vec<u16> = [0u16, 32, 65535, 30000, 40000, 50000, 1, 2, 3].into_iter().map(to_code).collect();
+ assert_eq!(cineon_written(&out), (3, 3, 1, want));
+ assert!(fidelity_warnings(&wide, Format::Cineon).contains(&FidelityWarning::AlphaDiscarded));
+ let gray8 = Image::from_u8(2, 1, ChannelLayout::Gray, vec![0, 255]).unwrap();
+ assert_eq!(cineon_written(&encode(&gray8, Format::Cineon, &EncodeOptions::default()).unwrap()), (1, 2, 1, vec![0, 1023]));
+}
diff --git a/crates/io/tests/flat.rs b/crates/io/tests/flat.rs
index b82b41ffc..decaa2498 100644
--- a/crates/io/tests/flat.rs
+++ b/crates/io/tests/flat.rs
@@ -56,6 +56,9 @@ codec_rt!(fits_rgb32, "fits", ColorMode::Rgb, SampleType::F32, false, 0.0);
codec_rt!(dpx_gray8, "dpx", ColorMode::Grayscale, SampleType::U8, false, 0.0);
codec_rt!(dpx_rgb16, "dpx", ColorMode::Rgb, SampleType::U16, false, 0.0);
codec_rt!(dpx_rgba16, "dpx", ColorMode::Rgb, SampleType::U16, true, 0.0);
+// Cineon stores 10-bit code values: within half a 10-bit step.
+codec_rt!(cin_gray16, "cin", ColorMode::Grayscale, SampleType::U16, false, 0.5 / 1023.0);
+codec_rt!(cin_rgb16, "cin", ColorMode::Rgb, SampleType::U16, false, 0.5 / 1023.0);
fn indexed_bmp_8() -> Vec<u8> {
const FILE_HEADER_SIZE: usize = 14;
diff --git a/docs/file-format-parity.md b/docs/file-format-parity.md
index ba7462370..8bd047d5a 100644
--- a/docs/file-format-parity.md
+++ b/docs/file-format-parity.md
@@ -1,6 +1,6 @@
# File-format parity
-> **Last reviewed:** 2026-10-12 · **Last updated:** 2026-10-13 · **Change:** minor (earlier: PDF write one flattened page via Save As / Save a Copy / CLI, #3401; CMYK Invert, Posterize and Threshold on the inks; smart filter masks on PSD open and save; Photoshop-oracle floor 188/258; lossy DNG, compression 34892, decodes with its levels and LinearizationTable applied to the stored 8-bit samples, FILE-215-11; CMYK Hue/Saturation and Color Balance keep the black ink; CMYK Posterize on the stored values, psd-tools oracle floor 242/309; CMYK adjustment layers composite on the document's inks; Photoshop-oracle floor 165/258; CMYK Brightness/Contrast on the inks, CMYK Threshold's luma; modern Brightness/Contrast's brightness curve; Photoshop-oracle floor 151/258; Lab documents composite on their stored L, a, b; Photoshop-oracle floor 152/258; Levels on whole levels at every step with Photoshop's shadow toe; Photoshop-oracle floor 146/258, psd-tools 238/309; 32-bit adjustments unclipped; Photoshop-oracle floor 149/258; mask feathers blur with their exact variance; Threshold splits on Photoshop's luminosity; a pass-through clipping base with an adjustment renders isolated; psd-tools oracle floor 240/309; 16-bit Posterize as Photoshop bins it; psd-tools oracle floor 241/309; Gradient Map luminosity; Photoshop-oracle floor 147/258; PSD: `Mt16`/`Mt32` merged transparency read; palette PNGs open in Indexed Color mode, #4804; earlier: CMYK Invert, Posterize and Threshold on the inks; 16-bit Lab Invert; Photoshop-oracle floor 145/258; `.atn` import maps 112 events; DDS textures open, #1327; DPX read and write, #1049; #2465 fixed: CS2 placed layers with only a `PlLd` block open their contents; Photoshop Actions `.atn` read and write; `.shc` contour files read and write; earlier the same day: indexed BMP palette mode; Save keeps a JPEG's quality and a WebP's encoding) · **Target:** Adobe Photoshop 2026
+> **Last reviewed:** 2026-10-12 · **Last updated:** 2026-10-15 · **Change:** minor (Cineon write: 10-bit gray/RGB; earlier: PDF write one flattened page via Save As / Save a Copy / CLI, #3401; CMYK Invert, Posterize and Threshold on the inks; smart filter masks on PSD open and save; Photoshop-oracle floor 188/258; lossy DNG, compression 34892, decodes with its levels and LinearizationTable applied to the stored 8-bit samples, FILE-215-11; CMYK Hue/Saturation and Color Balance keep the black ink; CMYK Posterize on the stored values, psd-tools oracle floor 242/309; CMYK adjustment layers composite on the document's inks; Photoshop-oracle floor 165/258; CMYK Brightness/Contrast on the inks, CMYK Threshold's luma; modern Brightness/Contrast's brightness curve; Photoshop-oracle floor 151/258; Lab documents composite on their stored L, a, b; Photoshop-oracle floor 152/258; Levels on whole levels at every step with Photoshop's shadow toe; Photoshop-oracle floor 146/258, psd-tools 238/309; 32-bit adjustments unclipped; Photoshop-oracle floor 149/258; mask feathers blur with their exact variance; Threshold splits on Photoshop's luminosity; a pass-through clipping base with an adjustment renders isolated; psd-tools oracle floor 240/309; 16-bit Posterize as Photoshop bins it; psd-tools oracle floor 241/309; Gradient Map luminosity; Photoshop-oracle floor 147/258; PSD: `Mt16`/`Mt32` merged transparency read; palette PNGs open in Indexed Color mode, #4804; earlier: CMYK Invert, Posterize and Threshold on the inks; 16-bit Lab Invert; Photoshop-oracle floor 145/258; `.atn` import maps 112 events; DDS textures open, #1327; DPX read and write, #1049; #2465 fixed: CS2 placed layers with only a `PlLd` block open their contents; Photoshop Actions `.atn` read and write; `.shc` contour files read and write; earlier the same day: indexed BMP palette mode; Save keeps a JPEG's quality and a WebP's encoding) · **Target:** Adobe Photoshop 2026
Every format Photoshop 2026 (27.11.0) reads or writes, with PhotoCraft's support, fidelity and
tests. Photoshop's list comes from its `Info.plist` `CFBundleDocumentTypes`, the PiPL read/write
@@ -43,7 +43,7 @@ XL are missing (gap G10). Remaining: 300–500 h including PSD fidelity.
| Generic EPS / AI | R (rasterize) | no | no | |
| SVG | R (rasterize) | yes, as editable shape layers or a vector smart object | no | Better than Photoshop for editing; gradients approximated (FILE-215-9) |
| JPEG 2000 | R/W | no (#1047) | no | |
-| Cineon / DPX | R (DPX), R/W (CIN) | DPX: luma, RGB, RGBA at 8/10/12/16 bits, both byte orders (#1049); Cineon: 10-bit gray/RGB, read-only | DPX: 8/10/12/16 bits (`dpxBits`, `--dpx-bits`); Cineon no | Writes DPX, which Photoshop only reads; header fields (creator, project, copyright, transfer, frame rate, time code…) round-trip; Cineon read-only, no RLE |
+| Cineon / DPX | R (DPX), R/W (CIN) | DPX: luma, RGB, RGBA at 8/10/12/16 bits, both byte orders (#1049); Cineon: 10-bit gray/RGB | DPX: 8/10/12/16 bits (`dpxBits`, `--dpx-bits`); Cineon: 10-bit log gray/RGB (Save As `.cin`) | Writes DPX, which Photoshop only reads; header fields (creator, project, copyright, transfer, frame rate, time code…) round-trip; a Cineon frame saved as Cineon keeps its 10-bit code values; no RLE |
| DICOM | R/W | no | no | |
| PCX | R/W | no | no | |
| Pixar | R/W | no | no | |
@@ -142,6 +142,7 @@ remaining gaps in #1606 stay tracked with per-sample corpus ceilings.
| Date | Change | Summary |
|---|---|---|
+| 2026-10-15 | minor | Cineon write: Save As `.cin` stores 10-bit log gray/RGB frames (Cineon 4.5 header, three samples to a 32-bit word); a Cineon frame saved back keeps its code values |
| 2026-10-14 | minor | PSD smart filter masks: Photoshop stores a smart object's filtered pixels without its filter mask and mixes the unfiltered ones (`FEid`) back in; import now mixes them and export writes them that way, so sf-filter-mask-hard, -gradient and sf-stack-blend-and-mask pass; Photoshop-oracle floor 185 → 188 of 258 |
| 2026-10-13 | minor | Lossy DNG (compression 34892) decodes: 8-bit baseline JPEG tiles and strips, CFA and LinearRaw, partial edge tiles; the stored values take the normal levels and LinearizationTable (FILE-215-11, lossy DNG part) |
| 2026-10-14 | minor | Corpus floors raised to the measured results of the CMYK, Lab, 32-bit, Levels, Threshold, Posterize, feather and pass-through fixes landed together: Photoshop-authored 165 → 185 of 258, io 146 → 148 of 170, psd-tools 242 → 249 of 309 |
diff --git a/docs/gaps.md b/docs/gaps.md
index faf0884c8..71b2317d5 100644
--- a/docs/gaps.md
+++ b/docs/gaps.md
@@ -1,6 +1,6 @@
# Where PhotoCraft falls short of Photoshop
-> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-13 · **Change:** minor (G1: smart filter masks show on PSD open, Photoshop-oracle floor 188/258; G10: DPX read and write, #1049, Cineon read; G1: CMYK Hue/Saturation and Color Balance keep the black ink; G1: CMYK Posterize on the stored values, psd-tools oracle floor 242/309; G1: CMYK adjustment layers composite on the document's inks, Photoshop-oracle floor 165/258; G1: CMYK Brightness/Contrast on the inks, CMYK Threshold's luma; G1: modern Brightness/Contrast's brightness curve matches Photoshop, Photoshop-oracle floor 151/258; G1: Lab documents composite on their stored L, a, b, Photoshop-oracle floor 152/258; G1: Levels on whole levels at every step, Photoshop-oracle floor 146/258, psd-tools 238/309; G1: 32-bit Brightness/Contrast legacy, Channel Mixer, Photo Filter and Black & White tint unclipped as in Photoshop, Photoshop-oracle floor 149/258; G1: mask feathers blur with their exact variance, psd-tools oracle floor 240/309; G1: Threshold splits on Photoshop's luminosity, psd-tools oracle floor 241/309; G1: pass-through clipping base with an adjustment renders isolated, psd-tools oracle floor 240/309; G1: 16-bit Posterize as Photoshop bins it, psd-tools oracle floor 241/309; G1: Gradient Map driven by the W3C luminosity, Photoshop-oracle floor 147/258; G7: Field Blur's on-canvas pins, #3373; G4: Hue Jitter amount track, #3825 partial; G4: minimum field interaction, #3825 partial; G1: CMYK Invert, Posterize and Threshold on the inks, 16-bit Lab Invert; Photoshop-oracle floor 145/258; G11: `.atn` import maps 112 events: Select and Mask, Filter Gallery Spatter, Ripple, Crystallize, Pattern Fill layers, mask targeting, Step Backward, nudges in points, Bitmap mode; G5: Free Transform H/V skew fields; G9: toolbar tool shortcut editing; refreshed against main: G2, G5, G7, G9, G10, G13, G14, G17 items that landed; G10: DPX read and write, #1049; G4: checkbox-only Brush Settings rows; G11: Load/Save Actions `.atn` landed, AUTO-219-2 partial; G5: hold-a-key spring-loaded tools landed, #2672; G1: #2465 fixed; stale missing-tool rows corrected: Color Replacement, Red Eye and Add/Delete Anchor Point are live tools, so only Art History Brush is missing; no estimate changed) · **Target:** Adobe Photoshop 2026
+> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-15 · **Change:** minor (G10: Cineon write; G1: smart filter masks show on PSD open, Photoshop-oracle floor 188/258; G10: DPX read and write, #1049, Cineon read; G1: CMYK Hue/Saturation and Color Balance keep the black ink; G1: CMYK Posterize on the stored values, psd-tools oracle floor 242/309; G1: CMYK adjustment layers composite on the document's inks, Photoshop-oracle floor 165/258; G1: CMYK Brightness/Contrast on the inks, CMYK Threshold's luma; G1: modern Brightness/Contrast's brightness curve matches Photoshop, Photoshop-oracle floor 151/258; G1: Lab documents composite on their stored L, a, b, Photoshop-oracle floor 152/258; G1: Levels on whole levels at every step, Photoshop-oracle floor 146/258, psd-tools 238/309; G1: 32-bit Brightness/Contrast legacy, Channel Mixer, Photo Filter and Black & White tint unclipped as in Photoshop, Photoshop-oracle floor 149/258; G1: mask feathers blur with their exact variance, psd-tools oracle floor 240/309; G1: Threshold splits on Photoshop's luminosity, psd-tools oracle floor 241/309; G1: pass-through clipping base with an adjustment renders isolated, psd-tools oracle floor 240/309; G1: 16-bit Posterize as Photoshop bins it, psd-tools oracle floor 241/309; G1: Gradient Map driven by the W3C luminosity, Photoshop-oracle floor 147/258; G7: Field Blur's on-canvas pins, #3373; G4: Hue Jitter amount track, #3825 partial; G4: minimum field interaction, #3825 partial; G1: CMYK Invert, Posterize and Threshold on the inks, 16-bit Lab Invert; Photoshop-oracle floor 145/258; G11: `.atn` import maps 112 events: Select and Mask, Filter Gallery Spatter, Ripple, Crystallize, Pattern Fill layers, mask targeting, Step Backward, nudges in points, Bitmap mode; G5: Free Transform H/V skew fields; G9: toolbar tool shortcut editing; refreshed against main: G2, G5, G7, G9, G10, G13, G14, G17 items that landed; G10: DPX read and write, #1049; G4: checkbox-only Brush Settings rows; G11: Load/Save Actions `.atn` landed, AUTO-219-2 partial; G5: hold-a-key spring-loaded tools landed, #2672; G1: #2465 fixed; stale missing-tool rows corrected: Color Replacement, Red Eye and Add/Delete Anchor Point are live tools, so only Art History Brush is missing; no estimate changed) · **Target:** Adobe Photoshop 2026
Every known shortfall against Photoshop 2026 (27.11.0), one entry each, ranked by user impact
on the way to beta. This is the work list agents pick from: take the highest-ranked entry that
@@ -225,12 +225,13 @@ what an agent can't finish alone.
- **Missing:** JPEG Options dialog (FILE-215-19), Photoshop PDF read and its vector/text/multi-page
write (FILE-215-10, #2541; a single flattened page now saves via Save As / Save a Copy / CLI,
2026-10-11, #3401), AVIF read (#463) and default-build AVIF write, JPEG XL, JPEG 2000 (#1047),
- Cineon write (read landed), DICOM, EPS/DCS, Pixar, IFF, WBMP, MPO/JPS, PICT, Scitex CT, Photoshop
+ DICOM, EPS/DCS, Pixar, IFF, WBMP, MPO/JPS, PICT, Scitex CT, Photoshop
Raw; layered TIFF extra alpha channels (FILE-215-7); spot plates (FILE-215-17); .atn, .asl,
.shc, .csh presets (FILE-215-15); C2PA (#1050).
- **Detail:** [`file-format-parity.md`](file-format-parity.md).
-- **Progress (2026-10-13):** Cineon (`.cin`) 10-bit gray/RGB frames open read-only, sharing the
- DPX header/unpacking (`crates/codecs/src/codecs/dpx.rs`); writing is still open.
+- **Progress (2026-10-15):** Cineon (`.cin`) 10-bit gray/RGB frames open and save (Save As
+ `.cin`), sharing the DPX header/packing (`crates/codecs/src/codecs/dpx.rs`); a Cineon frame saved
+ back keeps its code values.
- **Estimate:** 120–220 h.
## Hardware gaps
@@ -270,6 +271,7 @@ what an agent can't finish alone.
| Date | Change | Summary |
|---|---|---|
+| 2026-10-15 | minor | G10: Cineon write landed (10-bit log gray/RGB, Save As `.cin`) |
| 2026-10-14 | minor | G1: a PSD smart object's filter mask shows when the file opens (Photoshop stores the filtered pixels unmasked); export stores them that way too; Photoshop-oracle floor 185 → 188 of 258 |
| 2026-10-13 | minor | G14: D90 image area measured (4288 × 2848 at (10, 10)); gap remains open |
| 2026-10-14 | minor | Corpus floors raised to the measured results of the CMYK, Lab, 32-bit, Levels, Threshold, Posterize, feather and pass-through fixes landed together: Photoshop-authored 165 → 185 of 258, io 146 → 148 of 170, psd-tools 242 → 249 of 309 |