#png #encoder #streaming

repng

The PNG encoder that no one asked for

4 releases

Uses old Rust 2015

0.2.2 Apr 5, 2018
0.2.1 Apr 5, 2018
0.2.0 Apr 5, 2018
0.1.0 Apr 5, 2018

#846 in Images

Download history 9778/week @ 2023-12-10 10059/week @ 2023-12-17 11063/week @ 2023-12-24 10116/week @ 2023-12-31 10367/week @ 2024-01-07 9893/week @ 2024-01-14 9533/week @ 2024-01-21 10160/week @ 2024-01-28 12312/week @ 2024-02-04 10292/week @ 2024-02-11 4762/week @ 2024-02-18 6621/week @ 2024-02-25 8201/week @ 2024-03-03 9895/week @ 2024-03-10 11905/week @ 2024-03-17 12219/week @ 2024-03-24

43,126 downloads per month
Used in scrap

MIT license

20KB
456 lines

repng

It encodes PNGs.

Usage

  1. Add repng = "0.2" to your Cargo.toml in the dependencies section.
  2. Check out an example.
  3. Read the documentation.

lib.rs:

The PNG encoder that no one asked for.

The abstraction is pretty leaky, but it's simple enough that you can make cool things without much effort, such as this program, which creates a very blank image.

use repng::Options;

let mut png = Vec::new();

{
    let mut encoder = Options::smallest(480, 360)
        .build(&mut png)
        .unwrap();

    let row = [255; 480 * 4];

    for y in 0..360 {
        encoder.write(&row).unwrap();
    }

    encoder.finish().unwrap();
}

println!("{:?}", png);

Dependencies

~425KB