From 3163a925946f307c5cc0ed0f475724f5e7a5eddc Mon Sep 17 00:00:00 2001 From: Kornel Date: Fri, 15 Jan 2021 13:50:45 +0000 Subject: [PATCH] Ignore broken tRNS --- src/reduction/color.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/reduction/color.rs b/src/reduction/color.rs index b7c07512..42d47c9b 100644 --- a/src/reduction/color.rs +++ b/src/reduction/color.rs @@ -111,6 +111,7 @@ pub fn reduced_color_to_palette(png: &PngImage) -> Option { let transparency_pixel = png .transparency_pixel .as_ref() + .filter(|t| png.ihdr.color_type == ColorType::RGB && t.len() >= 6) .map(|t| RGB8::new(t[1], t[3], t[5])); for line in png.scan_lines() { raw_data.push(line.filter);