apng

apng at crates.io apng at docs.rs License

apng is animation png encoder for rust, and made in pure rust.

Example usage

```rust fn main() { let files = vec![ "sample/rustlogo1.png", "sample/rustlogo2.png", "sample/rustlogo3.png", "sample/rustlogo4.png", "sample/rustlogo5.png", "sample/rustlogo6.png", ];

let mut png_images: Vec<PNGImage> = Vec::new();
for f in files.iter() {
    png_images.push(apng::load_png(f).unwrap());
}

let path = Path::new(r"sample/out.png");
let mut out = BufWriter::new(File::create(path).unwrap());

let config = apng::create_config(&png_images, None).unwrap();
let mut encoder = Encoder::new(&mut out, config).unwrap();
let frame = Frame {
    delay_num: Some(1),
    delay_den: Some(2),
    ..Default::default()
};

match encoder.encode_all(png_images, Some(&frame)) {
    Ok(_n) => println!("success"),
    Err(err) => eprintln!("{}", err),
}

} ```

License

here

see also

medium

Reference