diff --git a/codecs/png/pkg/squoosh_png_bg.wasm b/codecs/png/pkg/squoosh_png_bg.wasm index 15d0ec03..cc5cf366 100644 Binary files a/codecs/png/pkg/squoosh_png_bg.wasm and b/codecs/png/pkg/squoosh_png_bg.wasm differ diff --git a/codecs/png/src/lib.rs b/codecs/png/src/lib.rs index d5eacfce..e23cf7dd 100644 --- a/codecs/png/src/lib.rs +++ b/codecs/png/src/lib.rs @@ -53,7 +53,11 @@ where #[wasm_bindgen] pub fn decode(mut data: &[u8]) -> ImageData { let mut decoder = png::Decoder::new(&mut data); - decoder.set_transformations(png::Transformations::EXPAND); + decoder.set_transformations( + png::Transformations::EXPAND | // Turn paletted images into RGB + png::Transformations::PACKING | // Turn images <8bit to 8bit + png::Transformations::STRIP_16, // Turn 16bit into 8 bit + ); let (info, mut reader) = decoder.read_info().unwrap_throw(); let num_pixels = (info.width * info.height) as usize; let mut buf = vec![0; num_pixels * 4];