about summary refs log tree commit diff
path: root/examples/read.rs
diff options
context:
space:
mode:
authorGenny <gen@nyble.dev>2021-10-12 00:48:58 -0500
committerGenny <gen@nyble.dev>2021-10-12 00:48:58 -0500
commit41c60e38620ac68e32bcb977723e232ba12ecf4a (patch)
tree8f8bb40d535d7388a947f4b89b1d2ece6cbaba05 /examples/read.rs
parent757eab88d67a425728b87286c763387f52367196 (diff)
downloadgifed-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.rs22
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();
+}