From d684820d4a9801f25d7878c324fd459638f507b5 Mon Sep 17 00:00:00 2001 From: Andrew Date: Sat, 13 Apr 2024 10:25:38 +1200 Subject: [PATCH] Fix for latest image --- src/sanity_checks.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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()