Fix for latest image

This commit is contained in:
Andrew 2024-04-13 10:25:38 +12:00
parent 91ad402f52
commit d684820d4a

View file

@ -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<Vec<RgbaImage>, 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()