mirror of https://github.com/stelzo/typst.git
Skip empty ICC profiles
ICC profile decoding for PNGs is broken in the version of the `png` crate `image` currently depends on. The bugfix (4c5b0535f0) is released in `png`, but not yet in `image`. As a quick fix, we'll skip empty profiles, they are never valid anyway. Fixes #1333.
This commit is contained in:
parent
25e94cef03
commit
11714609b8
|
|
@ -239,7 +239,7 @@ fn decode_raster(data: &Buffer, format: RasterFormat) -> StrResult<Arc<DecodedIm
|
|||
decoder: ImageResult<T>,
|
||||
) -> ImageResult<(image::DynamicImage, Option<IccProfile>)> {
|
||||
let mut decoder = decoder?;
|
||||
let icc = decoder.icc_profile().map(IccProfile);
|
||||
let icc = decoder.icc_profile().filter(|data| !data.is_empty()).map(IccProfile);
|
||||
decoder.set_limits(Limits::default())?;
|
||||
let dynamic = image::DynamicImage::from_decoder(decoder)?;
|
||||
Ok((dynamic, icc))
|
||||
|
|
|
|||
Loading…
Reference in New Issue