From 41c60e38620ac68e32bcb977723e232ba12ecf4a Mon Sep 17 00:00:00 2001 From: Genny Date: Tue, 12 Oct 2021 00:48:58 -0500 Subject: Actually implement image iterator I forgot to implement next, oops! --- examples/read.rs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 examples/read.rs (limited to 'examples') diff --git a/examples/read.rs b/examples/read.rs new file mode 100644 index 0000000..3c40bfe --- /dev/null +++ b/examples/read.rs @@ -0,0 +1,22 @@ +use gifed::{ + reader::{self, GifReader}, + writer::ImageBuilder, + Gif, +}; + +fn main() { + let reader = GifReader::file("examples/simulation.gif").unwrap(); + let first = reader.images().next().unwrap(); + + Gif::builder(first.width(), first.height()) + .palette(first.palette().clone()) + .image( + ImageBuilder::new(first.width(), first.height()) + .transparent_index(first.transparent_index()) + .indicies(first.indicies()), + ) + .build() + .unwrap() + .save("first.gif") + .unwrap(); +} -- cgit 1.4.1-3-g733a5