[−][src]Function imghdr::what
pub fn what<T: Read>(f: T) -> Option<Type>
Tests the image data contained in the f
bytes stream.
Examples
ⓘThis example is not tested
use std::fs::File; use std::io::Read; let mut file = File::open("/path/to/image.png").unwrap(); let mut content: Vec<u8> = vec![]; file.read_to_end(&mut content).unwrap(); println!("{:?}", imghdr::what(content.as_slice()));