mirror of
https://github.com/storytold/photocraft.git
synced 2026-12-02 06:20:48 +01:00
fix(io): GIF export keeps the indexed palette, unused entries and all
Saving an Indexed Color document as GIF went through the generic image encoder, which rebuilt the colour table from the colours present in the image. The entries no pixel used were dropped, the survivors changed index and the transparent index moved, so a pixel-art palette did not survive a save even though the picture looked the same. PNG and PSD already wrote the document's own table. Take the GIF save through export_mode_specific next to the palette PNG and BMP, which have the document and its colour table in hand, and encode with the codec's existing indexed GIF writer. Indices come from the document's table, so they pass through unchanged rather than being nearest-colour remapped into a new one. A GIF colour table holds 2^n entries: the writer pads the slots past the document's last entry with black, the way the palette BMP's table is padded, so no used index moves. An RGB-mode document still takes the quantizing path, and an indexed document with no usable table falls back to it rather than failing the save. The indexed route encodes from the document instead of through encode_image, so it now reports the metadata a GIF cannot hold in the words the generic encoder's fidelity warnings use. Tests (crates/io/tests/it/modes.rs): unused entries survive a save and reopening; a 200-entry palette lands in a 256-entry table with its indices intact; every pixel keeps its index at 8/16/32 bits; the transparent index is kept; a saved GIF round-trips unchanged; the metadata warnings; an RGB GIF still quantizes; no usable table falls back; a table with no opaque entry errors instead of writing a blank.
This commit is contained in:
1 parent
f68e227026
commit
d06b24f96b
3 files changed
+208
-9
No files matched your search
+44
-7
@@ -1673,11 +1673,11 @@ pub fn export_flat_with_renderer(
|
||||
mut renderer: Option<&mut dyn BandRenderer>,
|
||||
) -> Result<ExportResult, IoError> {
|
||||
if let Some(mut r) = export_mode_specific(doc, format, opts)? {
|
||||
// Palette PNG/BMP and Duotone exports render on their own paths before the renderer
|
||||
// Palette PNG/BMP/GIF and Duotone exports render on their own paths before the renderer
|
||||
// branch: say so, or `--gpu` would silently do nothing for them.
|
||||
if let Some(renderer) = &mut renderer {
|
||||
let why = match doc.mode {
|
||||
ColorMode::Indexed => "palette (Indexed Color) PNG/BMP export uses the CPU compositor",
|
||||
ColorMode::Indexed => "palette (Indexed Color) PNG/BMP/GIF export uses the CPU compositor",
|
||||
ColorMode::Duotone => "Duotone export uses the CPU compositor",
|
||||
_ => "this export uses the CPU compositor",
|
||||
};
|
||||
@@ -2258,16 +2258,44 @@ fn cmyk_image_to_srgb(img: &Image) -> Result<Image, IoError> {
|
||||
Ok(Image::from_normalized(w, h, layout, sample, &out)?.with_icc(Some(dst.to_bytes().to_vec())).with_meta(img.meta.clone()))
|
||||
}
|
||||
|
||||
/// Indexed Color → PNG-8 or an 8-bit BMP with its colour table; Duotone → the inks rendered as RGB.
|
||||
/// The metadata a GIF cannot hold, worded as the generic encoder's fidelity warnings word it.
|
||||
/// The indexed route encodes straight from the document instead of through [`encode_image`], so it
|
||||
/// has to report what that check would have warned about.
|
||||
fn gif_dropped_metadata(doc: &Document, opts: &ExportOptions) -> Vec<String> {
|
||||
let mut w = Vec::new();
|
||||
if !opts.encode.embed_metadata {
|
||||
return w;
|
||||
}
|
||||
if doc.icc_profile.is_some() && opts.encode.embed_icc {
|
||||
w.push("ICC profile not supported; it will be dropped".into());
|
||||
}
|
||||
if doc.metadata.exif.is_some() {
|
||||
w.push("EXIF not supported; it will be dropped".into());
|
||||
}
|
||||
// Export As ▸ Metadata: None already dropped these before the generic encoder got to say so.
|
||||
if opts.xmp != XmpEmbed::None {
|
||||
if doc.metadata.xmp.is_some() {
|
||||
w.push("XMP not supported; it will be dropped".into());
|
||||
}
|
||||
if !doc.metadata.text.is_empty() {
|
||||
w.push("text metadata not supported; it will be dropped".into());
|
||||
}
|
||||
}
|
||||
w.push("resolution (DPI) not supported; it will be dropped".into());
|
||||
w
|
||||
}
|
||||
|
||||
/// Indexed Color → PNG-8, an 8-bit BMP or a GIF with the document's colour table; Duotone → the
|
||||
/// inks rendered as RGB.
|
||||
fn export_mode_specific(doc: &Document, format: Format, opts: &ExportOptions) -> Result<Option<ExportResult>, IoError> {
|
||||
match doc.mode {
|
||||
ColorMode::Indexed if matches!(format, Format::Png | Format::Bmp) => {
|
||||
ColorMode::Indexed if matches!(format, Format::Png | Format::Bmp | Format::Gif) => {
|
||||
let Some(table) = doc.color_table.as_ref().filter(|t| !t.colors.is_empty() && t.colors.len() <= 256) else { return Ok(None) };
|
||||
// PNG transparency belongs to a palette index, not its RGB value. Keep the
|
||||
// PNG and GIF transparency belongs to a palette index, not its RGB value. Keep the
|
||||
// transparent entry out of opaque lookup, even when it duplicates an opaque colour.
|
||||
let png_transparent_index = table.transparent.map(usize::from).filter(|_| format == Format::Png);
|
||||
let transparent_index = table.transparent.map(usize::from).filter(|_| format != Format::Bmp);
|
||||
let (opaque_indices, colors): (Vec<u8>, Vec<_>) =
|
||||
table.colors.iter().copied().enumerate().filter(|(i, _)| Some(*i) != png_transparent_index).map(|(i, c)| (i as u8, c)).unzip();
|
||||
table.colors.iter().copied().enumerate().filter(|(i, _)| Some(*i) != transparent_index).map(|(i, c)| (i as u8, c)).unzip();
|
||||
let opaque = photocraft_doc::ColorTable { colors, transparent: None };
|
||||
let mut idx = try_buffer(doc.size.area() as usize, 1)?;
|
||||
photocraft_compose::render_bands(doc, doc.bounds(), 0, |band| -> Result<(), IoError> {
|
||||
@@ -2290,6 +2318,15 @@ fn export_mode_specific(doc: &Document, format: Format, opts: &ExportOptions) ->
|
||||
}
|
||||
return Ok(Some(ExportResult { bytes, warnings }));
|
||||
}
|
||||
if format == Format::Gif {
|
||||
// The whole table in its original order, as the palette PNG and BMP write it: a
|
||||
// GIF colour table holds 2^n entries, and the writer pads the ones past the
|
||||
// document's last entry with black, so no used index moves (#11824).
|
||||
let bytes = codecs::web::encode_gif_indexed(doc.size.width, doc.size.height, &idx, &table.colors, table.transparent, false)?;
|
||||
let mut warnings = vec![format!("written as a GIF with the document's colour table ({} colours)", table.colors.len())];
|
||||
warnings.extend(gif_dropped_metadata(doc, opts));
|
||||
return Ok(Some(ExportResult { bytes, warnings }));
|
||||
}
|
||||
// Same rule as the ordinary PNG encoder: the resolution goes into `pHYs` with the metadata.
|
||||
let dpi = opts.encode.embed_metadata.then_some((doc.resolution_dpi, doc.resolution_dpi));
|
||||
let bytes = codecs::encode_png_indexed(doc.size.width, doc.size.height, &idx, &table.colors, table.transparent, dpi, opts.encode.png_stereo)?;
|
||||
|
||||
@@ -209,3 +209,164 @@ fn indexed_bmp_without_a_usable_table_falls_back_to_rgb() {
|
||||
assert_eq!(u16::from_le_bytes([r.bytes[28], r.bytes[29]]), 24);
|
||||
}
|
||||
}
|
||||
|
||||
/// Entry `i` of `palette` as the normalized RGB an Indexed Color document holds, plus its alpha.
|
||||
fn entry_rgb(palette: &[[u8; 3]], i: usize) -> [f32; 4] {
|
||||
let c = palette.get(i).copied().unwrap_or([0, 0, 0]);
|
||||
[f32::from(c[0]) / 255.0, f32::from(c[1]) / 255.0, f32::from(c[2]) / 255.0, 1.0]
|
||||
}
|
||||
|
||||
/// An Indexed Color document, one pixel per palette entry, each holding that entry's colour.
|
||||
fn indexed_doc(palette: &[[u8; 3]], transparent: Option<u8>, depth: SampleType) -> Document {
|
||||
let mut d = Document::with_background("m", Size::new(palette.len() as u32, 1), ColorMode::Rgb, depth, Color::rgba(0.0, 0.0, 0.0, 1.0));
|
||||
d.mode = ColorMode::Indexed;
|
||||
d.color_table = Some(ColorTable { colors: palette.to_vec(), transparent });
|
||||
{
|
||||
let s = d.layers[0].surface_mut().unwrap();
|
||||
for x in 0..palette.len() {
|
||||
s.write_pixel(x as i32, 0, &entry_rgb(palette, x));
|
||||
}
|
||||
}
|
||||
d
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn indexed_gif_keeps_unused_palette_entries() {
|
||||
// #11824: a GIF save rebuilt the colour table from the colours present in the image, so the
|
||||
// entries no pixel used vanished and the rest changed index. Palette PNG and BMP keep the
|
||||
// document's table; GIF now does the same.
|
||||
let mut palette = vec![[10, 20, 30], [200, 100, 50]];
|
||||
// Reserved entries no pixel uses: pixel art keeps them for later edits and palette swaps.
|
||||
palette.extend((2..8u8).map(|i| [i, i * 16, 255 - i]));
|
||||
let mut d = doc(ColorMode::Indexed);
|
||||
d.color_table = Some(ColorTable { colors: palette.clone(), transparent: None });
|
||||
let r = photocraft_io::export(&d, "x.gif", &Default::default()).unwrap();
|
||||
assert_eq!(photocraft_codecs::gif_palette(&r.bytes).unwrap().0, palette, "every entry, in the original order");
|
||||
let back = photocraft_io::import("x.gif", &r.bytes).unwrap().document;
|
||||
assert_eq!(back.mode, ColorMode::Indexed);
|
||||
assert_eq!(back.color_table.as_ref().map(|t| t.colors.clone()), Some(palette), "reopened with the same table");
|
||||
let px = back.layers[0].surface().unwrap().rgba(1, 1);
|
||||
assert_eq!(&px[..3], &[200.0 / 255.0, 100.0 / 255.0, 50.0 / 255.0], "{px:?}");
|
||||
assert!(r.warnings.iter().any(|w| w.contains("colour table")), "{:?}", r.warnings);
|
||||
assert!(!r.warnings.iter().any(|w| w.contains("quantiz")), "the palette was not rebuilt: {:?}", r.warnings);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn indexed_gif_keeps_the_palette_index_of_every_pixel() {
|
||||
// Each pixel was drawn as one palette entry, so after the save its index must still mean that
|
||||
// entry rather than the nearest colour of a freshly built table.
|
||||
for depth in [SampleType::U8, SampleType::U16, SampleType::F32] {
|
||||
let palette: Vec<[u8; 3]> = (0..9u8).map(|i| [i * 28, (9 - i) * 24, i * 7 + 3]).collect();
|
||||
let d = indexed_doc(&palette, None, depth);
|
||||
let r = photocraft_io::export(&d, "out.gif", &Default::default()).unwrap();
|
||||
let table = photocraft_codecs::gif_palette(&r.bytes).unwrap();
|
||||
assert_eq!(table.0.get(..palette.len()), Some(&palette[..]), "{depth:?}");
|
||||
let back = photocraft_io::import("out.gif", &r.bytes).unwrap().document;
|
||||
let s = back.layers[0].surface().unwrap();
|
||||
for (x, c) in palette.iter().enumerate() {
|
||||
let px = s.rgba(x as i32, 0);
|
||||
for k in 0..3 {
|
||||
assert!((px[k] - f32::from(c[k]) / 255.0).abs() < 1.0 / 255.0, "{depth:?}, index {x}: {px:?} vs {c:?}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn indexed_gif_pads_a_200_entry_palette_to_256_entries() {
|
||||
// A GIF colour table holds 2^n entries. The document's 200 entries keep their slots and the
|
||||
// rest is padded with black (the palette BMP writer's convention too), so no used index moves.
|
||||
let palette: Vec<[u8; 3]> = (0..200u16).map(|i| [(i * 7 % 256) as u8, (i * 13 % 256) as u8, (255 - i % 256) as u8]).collect();
|
||||
let mut d = Document::with_background("m", Size::new(2, 1), ColorMode::Rgb, SampleType::U8, Color::rgba(0.0, 0.0, 0.0, 1.0));
|
||||
d.mode = ColorMode::Indexed;
|
||||
d.color_table = Some(ColorTable { colors: palette.clone(), transparent: None });
|
||||
{
|
||||
let s = d.layers[0].surface_mut().unwrap();
|
||||
s.write_pixel(0, 0, &entry_rgb(&palette, 0));
|
||||
s.write_pixel(1, 0, &entry_rgb(&palette, 199));
|
||||
}
|
||||
let r = photocraft_io::export(&d, "x.gif", &Default::default()).unwrap();
|
||||
let (colors, _) = photocraft_codecs::gif_palette(&r.bytes).unwrap();
|
||||
assert_eq!(colors.len(), 256, "padded to the next power of two");
|
||||
assert_eq!(&colors[..200], &palette[..], "the document's entries, in their original order");
|
||||
assert!(colors[200..].iter().all(|c| *c == [0, 0, 0]), "the padding holds no palette colours");
|
||||
let px = photocraft_io::import("x.gif", &r.bytes).unwrap().document.layers[0].surface().unwrap().rgba(1, 0);
|
||||
let want = entry_rgb(&palette, 199);
|
||||
for k in 0..3 {
|
||||
assert!((px[k] - want[k]).abs() < 1.0 / 255.0, "index 199 still means entry 199: {px:?} vs {:?}", palette[199]);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn indexed_gif_keeps_the_transparent_index() {
|
||||
let mut d = Document::with_background("m", Size::new(2, 1), ColorMode::Rgb, SampleType::U8, Color::rgba(1.0, 0.0, 0.0, 1.0));
|
||||
d.mode = ColorMode::Indexed;
|
||||
d.color_table = Some(ColorTable { colors: vec![[255, 0, 0], [0, 255, 0], [0, 0, 255]], transparent: Some(2) });
|
||||
d.layers[0].surface_mut().unwrap().write_pixel(1, 0, &[0.0, 0.0, 1.0, 0.0]);
|
||||
let r = photocraft_io::export(&d, "x.gif", &Default::default()).unwrap();
|
||||
assert_eq!(photocraft_codecs::gif_palette(&r.bytes).unwrap().1, Some(2), "the designated transparent index");
|
||||
let back = photocraft_io::import("x.gif", &r.bytes).unwrap().document;
|
||||
assert_eq!(back.color_table.as_ref().unwrap().transparent, Some(2));
|
||||
let s = back.layers[0].surface().unwrap();
|
||||
assert_eq!(s.rgba(1, 0)[3], 0.0, "the transparent entry stays transparent");
|
||||
assert_eq!(s.rgba(0, 0)[3], 1.0, "the opaque pixel keeps entry 0");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn indexed_gif_round_trips_a_saved_gif() {
|
||||
// Regression: a GIF opened and saved again keeps its table and its decoded pixels.
|
||||
let palette = [[10, 20, 30], [200, 100, 50], [7, 8, 9], [0, 255, 0]];
|
||||
let bytes = photocraft_codecs::web::encode_gif_indexed(4, 1, &[0, 1, 2, 3], &palette, Some(2), false).unwrap();
|
||||
let d = photocraft_io::import("in.gif", &bytes).unwrap().document;
|
||||
let before = d.color_table.clone();
|
||||
let r = photocraft_io::export(&d, "out.gif", &Default::default()).unwrap();
|
||||
assert_eq!(photocraft_codecs::gif_palette(&r.bytes), photocraft_codecs::gif_palette(&bytes));
|
||||
assert_eq!(photocraft_codecs::decode(&r.bytes).unwrap().data(), photocraft_codecs::decode(&bytes).unwrap().data());
|
||||
let back = photocraft_io::import("out.gif", &r.bytes).unwrap().document;
|
||||
assert_eq!(back.color_table, before, "reopening the save changes nothing");
|
||||
assert_eq!(d.color_table, before, "export must not edit the document's table");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn indexed_gif_warns_about_the_metadata_it_cannot_hold() {
|
||||
let mut d = doc(ColorMode::Indexed);
|
||||
d.color_table = Some(ColorTable { colors: vec![[0, 0, 0], [255, 0, 0]], transparent: None });
|
||||
d.metadata.text = vec![("Comment".into(), "kept".into())];
|
||||
let r = photocraft_io::export(&d, "x.gif", &Default::default()).unwrap();
|
||||
assert!(r.warnings.iter().any(|w| w.contains("text metadata")), "{:?}", r.warnings);
|
||||
assert!(r.warnings.iter().any(|w| w.contains("resolution (DPI)")), "{:?}", r.warnings);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn rgb_gif_still_quantizes_its_colors() {
|
||||
// Only an Indexed Color document keeps its table: an RGB GIF is still quantized as before.
|
||||
let d = doc(ColorMode::Rgb);
|
||||
let r = photocraft_io::export(&d, "x.gif", &Default::default()).unwrap();
|
||||
assert!(r.warnings.iter().any(|w| w.contains("quantized")), "{:?}", r.warnings);
|
||||
assert!(photocraft_codecs::gif_palette(&r.bytes).unwrap().0.contains(&[255, 0, 0]), "a table of the colours present");
|
||||
assert_eq!(photocraft_io::import("x.gif", &r.bytes).unwrap().document.mode, ColorMode::Indexed);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn indexed_gif_without_a_usable_table_falls_back_to_rgb() {
|
||||
// As with the palette BMP: no table (or one past 256 entries) keeps the quantizing path
|
||||
// rather than failing the save.
|
||||
for table in [None, Some(ColorTable { colors: vec![[0; 3]; 257], transparent: None })] {
|
||||
let mut d = doc(ColorMode::Indexed);
|
||||
d.color_table = table;
|
||||
let r = photocraft_io::export(&d, "x.gif", &Default::default()).unwrap();
|
||||
assert!(!r.bytes.is_empty());
|
||||
assert!(r.warnings.iter().any(|w| w.contains("quantized")), "{:?}", r.warnings);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn indexed_gif_rejects_opaque_pixels_without_an_opaque_entry() {
|
||||
// Same rule as the palette PNG: with only the transparent entry left, an opaque pixel has
|
||||
// nothing to point at, and the save says so instead of writing a GIF that shows nothing.
|
||||
let mut d = doc(ColorMode::Indexed);
|
||||
d.color_table = Some(ColorTable { colors: vec![[255, 0, 0]], transparent: Some(0) });
|
||||
let err = photocraft_io::export(&d, "out.gif", &Default::default()).unwrap_err();
|
||||
assert!(matches!(err, photocraft_io::IoError::Unsupported(_)), "{err}");
|
||||
assert!(err.to_string().contains("no opaque entry"), "{err}");
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
# File-format parity
|
||||
|
||||
> **Last reviewed:** 2026-10-12 · **Last updated:** 2026-11-02 · **Change:** minor (TIFF Options on Save As and Save a Copy: Image Compression None/LZW/ZIP, Save Image Pyramid, Save Transparency and Discard Layers, also `tiffTransparency`/`tiffPyramid` for scripts, the CLI and MCP, #8827; `.atn`: 145 supported events including Shear after Actions batch 12 (Groups A–I, command options, version 12 files, reference forms); the supported table and measured reference are in [atn.md](atn.md); TIFF: YCbCr images open as RGB, including JPEG-compressed scans with subsampled chroma, #10316; TIFFs up to 300,000 px a side open, decoded a group of rows at a time into the layer, #8169; embedded AI/PDF/EPS save-back retains native format with a source-bound SVG display preview; PSD Filter Gallery: Halftone Pattern dot/circle/line settings survive PSD/PSB saves (#8940); Save for Web writes WebP, lossy or lossless, #6391; Photoshop's `MTrn` merged-transparency marker, from a layered TIFF saved with Save Transparency, marks the merged transparency, #8877; layered TIFF writes the TySh text version and descriptor in PSD big-endian order while the header, matrix, warp and bounds keep container order, #9098; layered TIFF writes Photoshop's 14-byte global layer mask, so Photoshop opens the layers instead of only the composite, #9095; legacy PSD point text placed from the layout ink box after font resolution, #6094; `.atn`: a recorded Save As imports with its format and file (`file.saveAs`, `file.saveACopy` for As a Copy) instead of as a plain Save that wrote over the played file, #7102; folder destinations stop playback until #5430; `.asl` layer style libraries read and written, #1051; JPEG Options on File › Save, Save As and Save a Copy, FILE-215-19 partial (no Matte, progressive Scans or size preview); 32-bit Hue/Saturation unclipped and Colorize as Photoshop does them, Photoshop-oracle floor 190/258, #5781; JPEG Options on Save As and Save a Copy, FILE-215-19; TIFF compression for scripted saves, `tiffCompression`, #5301; the Nikon D4 white level follows the sample depth (12 and 14 bit), #5978; Apply Layer Comp action mapping, #7101; Cineon write: 10-bit gray/RGB; animated WebP frames load into video layers, #1198; Photoshop mixed-order TIFF type geometry, #4758; DDS textures save: uncompressed or BC1–BC3, optional mip chain, DDS Options in Save As (#1327); PSD smart filters: 53 filters (39 more: Pinch, Polar Coordinates, Ripple, Spherize, Twirl, Wave, ZigZag, Invert, Blur, Surface Blur, Smart Sharpen, Diffuse, Wind, Offset, Mezzotint, Clouds, Difference Clouds, Fibers, Lens Flare and others) plus Hue/Saturation and Perspective Warp mapped both ways, #6296, #6298, #6300, #6302, #6304, #6314, #6316, #6267, #6268, FILE-215-2; large-file fixtures: a 20 MP layered PSD, a 150-layer layout, a 2 GB PSD and a 4.4 GB PSB generated at test time and round-tripped, FILE-216-2 done, #5107; earlier: smart objects keep Photoshop's Cylinder warp through re-renders and saves, #4112; PNG `sTER` stereo pairing kept on save, #6063; 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; 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; Amiga IFF write: 24-plane ILBM, Save As `.iff`; PSD stores spot channels as Photoshop does, ink 0 = solid, and numbers them in 1053, #7415 split; TIFF writes and reads alpha and spot channels as extra samples wLine truncated
|
||||
> **Last reviewed:** 2026-10-12 · **Last updated:** 2026-11-07 · **Change:** minor (GIF: Indexed Color documents save with the document's own colour table, unused entries and transparent index included, #11824; TIFF Options on Save As and Save a Copy: Image Compression None/LZW/ZIP, Save Image Pyramid, Save Transparency and Discard Layers, also `tiffTransparency`/`tiffPyramid` for scripts, the CLI and MCP, #8827; `.atn`: 145 supported events including Shear after Actions batch 12 (Groups A–I, command options, version 12 files, reference forms); the supported table and measured reference are in [atn.md](atn.md); TIFF: YCbCr images open as RGB, including JPEG-compressed scans with subsampled chroma, #10316; TIFFs up to 300,000 px a side open, decoded a group of rows at a time into the layer, #8169; embedded AI/PDF/EPS save-back retains native format with a source-bound SVG display preview; PSD Filter Gallery: Halftone Pattern dot/circle/line settings survive PSD/PSB saves (#8940); Save for Web writes WebP, lossy or lossless, #6391; Photoshop's `MTrn` merged-transparency marker, from a layered TIFF saved with Save Transparency, marks the merged transparency, #8877; layered TIFF writes the TySh text version and descriptor in PSD big-endian order while the header, matrix, warp and bounds keep container order, #9098; layered TIFF writes Photoshop's 14-byte global layer mask, so Photoshop opens the layers instead of only the composite, #9095; legacy PSD point text placed from the layout ink box after font resolution, #6094; `.atn`: a recorded Save As imports with its format and file (`file.saveAs`, `file.saveACopy` for As a Copy) instead of as a plain Save that wrote over the played file, #7102; folder destinations stop playback until #5430; `.asl` layer style libraries read and written, #1051; JPEG Options on File › Save, Save As and Save a Copy, FILE-215-19 partial (no Matte, progressive Scans or size preview); 32-bit Hue/Saturation unclipped and Colorize as Photoshop does them, Photoshop-oracle floor 190/258, #5781; JPEG Options on Save As and Save a Copy, FILE-215-19; TIFF compression for scripted saves, `tiffCompression`, #5301; the Nikon D4 white level follows the sample depth (12 and 14 bit), #5978; Apply Layer Comp action mapping, #7101; Cineon write: 10-bit gray/RGB; animated WebP frames load into video layers, #1198; Photoshop mixed-order TIFF type geometry, #4758; DDS textures save: uncompressed or BC1–BC3, optional mip chain, DDS Options in Save As (#1327); PSD smart filters: 53 filters (39 more: Pinch, Polar Coordinates, Ripple, Spherize, Twirl, Wave, ZigZag, Invert, Blur, Surface Blur, Smart Sharpen, Diffuse, Wind, Offset, Mezzotint, Clouds, Difference Clouds, Fibers, Lens Flare and others) plus Hue/Saturation and Perspective Warp mapped both ways, #6296, #6298, #6300, #6302, #6304, #6314, #6316, #6267, #6268, FILE-215-2; large-file fixtures: a 20 MP layered PSD, a 150-layer layout, a 2 GB PSD and a 4.4 GB PSB generated at test time and round-tripped, FILE-216-2 done, #5107; earlier: smart objects keep Photoshop's Cylinder warp through re-renders and saves, #4112; PNG `sTER` stereo pairing kept on save, #6063; 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; 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; Amiga IFF write: 24-plane ILBM, Save As `.iff`; PSD stores spot channels as PhotoshLine truncated
|
||||
|
||||
**PSD Filter Gallery (#8940, 2026-10-23):** Halftone Pattern maps its size, contrast and dot/circle/line pattern as editable settings on import and export, with the reference application's descriptor keys (`HlSz`, `Cntr`, `ScrT`: `ScrD`/`ScrC`/`ScrL`). PSD/PSB round trips pass at 8/16/32 bits. This does not claim pixel equivalence for the existing renderer. Unknown or malformed settings remain verbatim on import.
|
||||
|
||||
@@ -29,7 +29,7 @@ XL are missing (gap G10). Remaining: 300–500 h including PSD fidelity.
|
||||
| TIFF | R/W | yes | yes | 8/16/32f, Gray/RGB/CMYK, YCbCr read as RGB (JPEG-compressed with subsampled chroma, or uncompressed without subsampling; #10316), BigTIFF, every IFD, banded parallel decode; flat pages up to 300,000 px a side open a group of rows at a time into the layer, with no full-size copy, and are refused with an error when the machine lacks the memory (Linux: free RAM and swap, cgroup limits; #8169); layered TIFF both byte orders, including Photoshop mixed-order type blocks on read (#4758/#4771) and TySh text descriptors written in PSD order (#9098) and Photoshop's 14-byte `LMsk` block (#9095); TIFF Options on Save As and Save a Copy (Image Compression None/LZW/ZIP, Save Image Pyramid, Save Transparency, Discard Layers and Save a Copy; scripts pass `tiffCompression`, `tiffTransparency`, `tiffPyramid`, `tiffLayers`; #8827), no JPEG compression, Pixel Order or Byte Order (the encoder writes interleaved samples in the machine's byte order); undecodable type keeps saved pixels (FILE-215-7); alpha and spot channels as extra samples (at most 16) with Photoshop's names, ink colours and solidity, spot ink stored 0 = solid (#7415); Save Transparency on keeps the transparency as the first extra sample ahead of the channels (a layered file marks it with `MTrn`, as Photoshop does), off mattes on white; unset, it is kept only without alpha or spot channels |
|
||||
| JPEG | R/W | yes | yes | 8-bit Gray/RGB/CMYK, ICC/EXIF/XMP; Save keeps the opened file's quality (estimated from its quantisation tables, #2399); File › Save, Save As and Save a Copy ask JPEG Options: Quality 0–12, starting at the opened file's quality or else the Export preference, and Baseline ("Standard") / Baseline Optimized / Progressive; scripts pass `quality`/`jpegFormat`, the CLI `--jpeg-format` (FILE-215-19). Baseline Optimized fits the Huffman tables only at 4:4:4 (Gray, CMYK) or progressive: RGB is written 4:2:0, which zune-jpeg 0.5.15 decodes wrongly with fitted tables, as in Save for Web. No Matte, progressive Scans (3–5) or size preview |
|
||||
| PNG | R/W | yes | yes | 8/16-bit, ICC/text; APNG first frame only; alpha channels on open (#2225); palette PNGs open in Indexed Color mode with their transparent entry (#4804); Save keeps a stereo PNG's `sTER` pairing (#6063) |
|
||||
| GIF | R/W | yes | yes | File › Open keeps the first frame; New Video Layer from File and Video Frames to Layers take every frame, with the timeline rate from the delays (#572). Per-frame delays and keeping the frames in `.pcraft` are not done |
|
||||
| GIF | R/W | yes | yes | File › Open keeps the first frame; New Video Layer from File and Video Frames to Layers take every frame, with the timeline rate from the delays (#572). Indexed Color documents save with the document's own colour table, unused entries and transparent index included, and pixel indices unchanged (#11824). Per-frame delays and keeping the frames in `.pcraft` are not done |
|
||||
| BMP | R/W | yes | yes | 8-bit; palette BMPs open in Indexed Color mode and Indexed Color documents save as palette BMPs (no transparency) |
|
||||
| WebP | R/W | yes | yes | Lossless and our own lossy VP8 encoder; ICC/EXIF/XMP; Save keeps an opened file lossy (at its quality) or lossless (#2399); Save for Web (Legacy) writes it too, lossy at its Quality or lossless, a format Photoshop's legacy dialog lacks (#6391). File › Open keeps an animation's first frame; New Video Layer from File and Video Frames to Layers take every frame, with the timeline rate from the durations (#1198) |
|
||||
| AVIF | R/W | no (#463) | optional feature, off by default | |
|
||||
@@ -151,6 +151,7 @@ The original reference entry retains its source date and historical totals; curr
|
||||
|
||||
| Date | Change | Summary |
|
||||
|---|---|---|
|
||||
| 2026-11-07 | minor | GIF: an Indexed Color document saves with its own colour table instead of a palette rebuilt from the colours present, so unused entries, the entry order, the index-to-colour relationship and the transparent index survive File › Save As and Save a Copy (#11824). GIF colour tables hold 2^n entries: the document's entries keep their slots and the rest is padded with black, as the palette BMP table is. An RGB document's GIF still quantizes, and Save for Web still rebuilds the palette when asked |
|
||||
| 2026-11-02 | minor | Actions Shear (`Shr `) loads, plays and saves the measured curve points and edge mode; unsafe subranges and unrepresentable forms remain kept steps (#10605). |
|
||||
| 2026-11-01 | minor | `.atn`: 23 newer measured forms mapped, including explicit Link/Unlink, Smart Object file operations, Make Type to Shape, radius-only Shape Blur, Artboard from Group and the Crop Photos parent; supported in batch 13; Link Layers keeps the measured toggle. Artboard forms with unmeasured settings and generated Crop helper steps remain kept. |
|
||||
| 2026-11-01 | minor | Recorded direct Gradient Map and Lab-range Replace Color load, play and retain their measured settings on save; unsupported forms remain preserved (part of #10607). |
|
||||
|
||||
Reference in new issue
Block a user