#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

#917 in Images

Download history 13956/week @ 2024-04-09 12590/week @ 2024-04-16 12346/week @ 2024-04-23 11543/week @ 2024-04-30 8923/week @ 2024-05-07 7675/week @ 2024-05-14 6674/week @ 2024-05-21 6758/week @ 2024-05-28 6067/week @ 2024-06-04 5638/week @ 2024-06-11 5530/week @ 2024-06-18 6303/week @ 2024-06-25 7933/week @ 2024-07-02 6067/week @ 2024-07-09 4759/week @ 2024-07-16 4506/week @ 2024-07-23

24,379 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

~430KB