Fix for latest image
This commit is contained in:
parent
91ad402f52
commit
d684820d4a
1 changed files with 4 additions and 3 deletions
|
|
@ -1,5 +1,6 @@
|
||||||
use image::{codecs::png::PngDecoder, *};
|
use image::{codecs::png::PngDecoder, *};
|
||||||
use log::{error, warn};
|
use log::{error, warn};
|
||||||
|
use std::io::Cursor;
|
||||||
|
|
||||||
/// Validate that the output png data still matches the original image
|
/// Validate that the output png data still matches the original image
|
||||||
pub fn validate_output(output: &[u8], original_data: &[u8]) -> bool {
|
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]
|
/// Loads a PNG image from memory to frames of [RgbaImage]
|
||||||
fn load_png_image_from_memory(png_data: &[u8]) -> Result<Vec<RgbaImage>, image::ImageError> {
|
fn load_png_image_from_memory(png_data: &[u8]) -> Result<Vec<RgbaImage>, image::ImageError> {
|
||||||
let decoder = PngDecoder::new(png_data)?;
|
let decoder = PngDecoder::new(Cursor::new(png_data))?;
|
||||||
if decoder.is_apng() {
|
if decoder.is_apng()? {
|
||||||
decoder
|
decoder
|
||||||
.apng()
|
.apng()?
|
||||||
.into_frames()
|
.into_frames()
|
||||||
.map(|f| f.map(|f| f.into_buffer()))
|
.map(|f| f.map(|f| f.into_buffer()))
|
||||||
.collect()
|
.collect()
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue