diff --git a/src/sanity_checks.rs b/src/sanity_checks.rs index d9f1b474..c8b9524a 100644 --- a/src/sanity_checks.rs +++ b/src/sanity_checks.rs @@ -1,5 +1,6 @@ use image::{codecs::png::PngDecoder, *}; use log::{error, warn}; +use std::io::Cursor; /// Validate that the output png data still matches the original image pub fn validate_output(output: &[u8], original_data: &[u8]) -> bool { @@ -34,10 +35,10 @@ pub fn validate_output(output: &[u8], original_data: &[u8]) -> bool { /// Loads a PNG image from memory to frames of [RgbaImage] fn load_png_image_from_memory(png_data: &[u8]) -> Result, image::ImageError> { - let decoder = PngDecoder::new(png_data)?; - if decoder.is_apng() { + let decoder = PngDecoder::new(Cursor::new(png_data))?; + if decoder.is_apng()? { decoder - .apng() + .apng()? .into_frames() .map(|f| f.map(|f| f.into_buffer())) .collect()