[][src]Function imghdr::from_file

pub fn from_file<T: AsRef<Path>>(path: T) -> Result<Option<Type>>

Open file and try to determine if it is an image.

Available only with std feature (enabled by default).

Errors

This function will return an Err(std::io::Error) if file is inaccessible or can't be read.

Examples

let result = imghdr::from_file("./tests/images/example.jpg");

println!("{:#?}", result);