#encoder #png #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

#941 in Images

Download history 7420/week @ 2024-07-28 9198/week @ 2024-08-04 6828/week @ 2024-08-11 9464/week @ 2024-08-18 10718/week @ 2024-08-25 11861/week @ 2024-09-01 9520/week @ 2024-09-08 7974/week @ 2024-09-15 9057/week @ 2024-09-22 10709/week @ 2024-09-29 10642/week @ 2024-10-06 10770/week @ 2024-10-13 10097/week @ 2024-10-20 12221/week @ 2024-10-27 13351/week @ 2024-11-03 10124/week @ 2024-11-10

47,152 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

~435KB