From 799e56250415fa549e1fc7a50487371058ace338 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Wed, 11 Nov 2026 03:40:22 +0000 Subject: [PATCH] heif: match Apple's chroma upsampling; pin craft-heif to storytold/craft-libs#799 --- Cargo.lock | 2 +- Cargo.toml | 2 +- crates/codecs/src/codecs/heif.rs | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6f78e4378c8..56b6421b94b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1416,7 +1416,7 @@ source = "git+https://github.com/storytold/craft-libs?rev=1b34eba41e62138fc2438d [[package]] name = "craft-heif" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=6e21c5b0b1358f7d5505e7ea395948fe21f4d872#6e21c5b0b1358f7d5505e7ea395948fe21f4d872" +source = "git+https://github.com/storytold/craft-libs?rev=081078bb1b44aeedfa5bef3d4f13d978dc77510a#081078bb1b44aeedfa5bef3d4f13d978dc77510a" dependencies = [ "heic-rs", "rayon", diff --git a/Cargo.toml b/Cargo.toml index a16e6f16b86..27eb4ee7a22 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -41,7 +41,7 @@ photocraft-ipp = { path = "crates/ipp" } # external craft-print = { git = "https://github.com/storytold/craft-libs", rev = "1b34eba41e62138fc2438d2734523b302840b45d" } # HEIC/HEIF: the shared decoder (replaces crates/heif; craft-libs#784). -craft-heif = { git = "https://github.com/storytold/craft-libs", rev = "6e21c5b0b1358f7d5505e7ea395948fe21f4d872" } +craft-heif = { git = "https://github.com/storytold/craft-libs", rev = "081078bb1b44aeedfa5bef3d4f13d978dc77510a" } craft-pdf = { git = "https://github.com/storytold/craft-libs", rev = "1b34eba41e62138fc2438d2734523b302840b45d", features = ["raster"] } craft-docpath = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "1b34eba41e62138fc2438d2734523b302840b45d" } craft-jpeg = { git = "https://github.com/storytold/craft-libs", rev = "1b34eba41e62138fc2438d2734523b302840b45d" } diff --git a/crates/codecs/src/codecs/heif.rs b/crates/codecs/src/codecs/heif.rs index 4d8120d8583..a5dc7692b07 100644 --- a/crates/codecs/src/codecs/heif.rs +++ b/crates/codecs/src/codecs/heif.rs @@ -55,7 +55,8 @@ pub(crate) fn decode(bytes: &[u8], limits: &Limits, keep_orientation: bool) -> R if !keep_orientation && (info.coded_width, info.coded_height) != (w, h) { limits.check_bytes(info.coded_width, info.coded_height, peak)?; } - let options = craft_heif::Options { max_pixels: limits.max_pixels, apply_transforms: !keep_orientation }; + // Photoshop on macOS opens HEIC through Apple's decoder, so match its chroma upsampling. + let options = craft_heif::Options { max_pixels: limits.max_pixels, apply_transforms: !keep_orientation, chroma: craft_heif::Chroma::Apple }; let decoded = craft_heif::decode(bytes, &options).map_err(err)?; // The decoder re-reads the container; trust its output's shape, not the probe's. let layout = if decoded.has_alpha { ChannelLayout::Rgba } else { ChannelLayout::Rgb };