about summary refs log tree commit diff
path: root/examples/read.rs
blob: 3c40bfe69b5374f3e85c5ac94701179d25bb6139 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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();
}