pub fn from_reader<T: Read>(f: T) -> Result<Option<Type>>
Expand description
Try to determine image format from an IO stream of bytes.
Available only with std
feature (enabled by default).
§Returns
Ok(Some(Type))
if it is a known image formatOk(None)
if it is probably not an imageErr(..)
if failed to read minimal bytes amount for a guess
§Examples
let mut file = File::open("./tests/images/example.png")?;
println!("{:?}", imghdr::from_reader(file));