heif: match Apple's chroma upsampling; pin craft-heif to storytold/craft-libs#799

This commit is contained in:
Dylan M. Taylor committed 2026-11-11 03:40:22 +00:00
1 parent bd78e0c985
commit 799e562504
3 files changed
+4 -3

No files matched your search

Generated
+1 -1
View File
@@ -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",
+1 -1
View File
@@ -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" }
+2 -1
View File
@@ -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 };