#png #decoder #png-decoder

no-std makepad-zune-png

A fast, correct and safe png decoder

1 unstable release

0.2.1 Sep 20, 2023

#452 in Images

Download history 25/week @ 2024-01-08 20/week @ 2024-01-15 10/week @ 2024-01-22 3/week @ 2024-01-29 13/week @ 2024-02-05 23/week @ 2024-02-12 32/week @ 2024-02-19 49/week @ 2024-02-26 27/week @ 2024-03-04 35/week @ 2024-03-11 25/week @ 2024-03-18 48/week @ 2024-03-25 77/week @ 2024-04-01 23/week @ 2024-04-08 27/week @ 2024-04-15 24/week @ 2024-04-22

157 downloads per month
Used in 8 crates (via makepad-widgets)

MIT OR Apache-2.0 OR Zlib

5.5K SLoC


A fast, correct and safe png decoder


  • This decoder (currently) expands images with less than 8 bpp to be 8 bits(one byte) automatically. This may or may not be desired depending on your use cases.
  • No support for the non-standard APNG (animation) extension.


  • Fast deflate decoder
  • Vectorized filters and bit manipulation
  • Memory friendly (few allocations)
  • Zero unsafe outside of platform specific intrinsics


First, include this in your Cargo.toml

zune-png = "0.2.0"

Then you can access the decoder in your library/binary.

use zune_png::PngDecoder;
// decode bytes
let decoder = PngDecoder::new(b"bytes").decode().unwrap();

Debug vs release

The decoder heavily relies on platform specific intrinsics, namely AVX2 and SSE to gain speed-ups in decoding, but they perform poorly in debug builds. To get reasonable performance even when compiling your program in debug mode, add this to your Cargo.toml:

# `zune-png` package will be always built with optimizations
opt-level = 3


The updated benchmarks comparing this decoder with other Rust and C decoders can be found here with the png prefix. Benchmarks are updated regularly to keep up with optimizations added.