Crate repng

Crate repng 

Source
Expand description

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);

Modules§

filter
Image filter selection algorithms.
meta
Add some metadata to the image.

Structs§

Compression
When compressing data, the compression level can be specified by a value in this struct.
Encoder
The main object, which does all of the encoding work.
Options
Image properties and compression options.

Enums§

ColorFormat
A color format, which specifies how the bytes represent the pixels.

Functions§

encode
Encode an RGBA image.