diff options
author | Genevieve Alfirevic <gen@nyble.dev> | 2022-04-05 00:56:43 -0500 |
---|---|---|
committer | Genevieve Alfirevic <gen@nyble.dev> | 2022-04-05 00:56:43 -0500 |
commit | 9c025f2abcc391e87595781801e9ee0ea4968442 (patch) | |
tree | 35b1e8d0aa56fed3e144767907c5cf60aac3eaa2 /gifprobe/src/main.rs | |
parent | 8395c74a9706e5d180a917b633af57a3fe1ad400 (diff) | |
download | gifed-9c025f2abcc391e87595781801e9ee0ea4968442.tar.gz gifed-9c025f2abcc391e87595781801e9ee0ea4968442.zip |
gifprobe: Display some more information about application extensions
Diffstat (limited to 'gifprobe/src/main.rs')
-rw-r--r-- | gifprobe/src/main.rs | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/gifprobe/src/main.rs b/gifprobe/src/main.rs index f73384d..c6bc0f8 100644 --- a/gifprobe/src/main.rs +++ b/gifprobe/src/main.rs @@ -1,10 +1,9 @@ -use std::{convert::TryInto, fs::File, io::Write, path::Path}; - use gifed::{ - block::{extension::GraphicControl, Block, ColorTable, IndexedImage, Version}, + block::{ + Block::{self}, + IndexedImage, + }, reader::GifReader, - writer::{GifBuilder, ImageBuilder}, - Color, }; use owo_colors::OwoColorize; @@ -94,6 +93,19 @@ fn main() { } else { println!("\tLoop {}", looping.yellow()); } + } else { + let data = app.data(); + + match String::from_utf8(data.to_vec()) { + Ok(s) => println!( + "\tData {}", + format!("Valid UTF-8, {} bytes", s.len()).yellow() + ), + Err(_e) => println!( + "\tData {}", + format!("Invalid UTF-8, {} bytes", data.len()).yellow() + ), + } } } } @@ -117,7 +129,7 @@ fn describe_image(bli: &IndexedImage) { bli.image_descriptor.height.yellow(), ); - if bli.image_descriptor.color_table_present() { + if bli.image_descriptor.has_color_table() { println!( "\tLocal Color Table Present {}\n\tLocal Color Table Size {}", "Yes".green(), |