diff options
author | Genny <gen@nyble.dev> | 2021-10-12 00:48:58 -0500 |
---|---|---|
committer | Genny <gen@nyble.dev> | 2021-10-12 00:48:58 -0500 |
commit | 41c60e38620ac68e32bcb977723e232ba12ecf4a (patch) | |
tree | 8f8bb40d535d7388a947f4b89b1d2ece6cbaba05 /examples/read.rs | |
parent | 757eab88d67a425728b87286c763387f52367196 (diff) | |
download | gifed-41c60e38620ac68e32bcb977723e232ba12ecf4a.tar.gz gifed-41c60e38620ac68e32bcb977723e232ba12ecf4a.zip |
Actually implement image iterator
I forgot to implement next, oops!
Diffstat (limited to 'examples/read.rs')
-rw-r--r-- | examples/read.rs | 22 |
1 files changed, 22 insertions, 0 deletions
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(); +} |