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
47,152 downloads per month
Used in scrap
20KB
456 lines
repng
It encodes PNGs.
Usage
- Add
repng = "0.2"
to yourCargo.toml
in the dependencies section. - Check out an example.
- 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