Function imghdr::what [] [src]

pub fn what<T: Read>(f: T) -> Option<Type>

Tests the image data contained in the f bytes stream.

Examples

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()));