diff options
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(); +} |