Skip to main content

get_format_from_data_mime_and_filename

Function get_format_from_data_mime_and_filename 

Source
fn get_format_from_data_mime_and_filename(
    data: &[u8],
    mime: Option<&str>,
    filename: Option<&str>,
) -> Result<ImageFormat, BlurhashingError>
Expand description

Gets the Image Format value from the data,mime, and filename It first checks if the mime is a valid image format Then it checks if the filename has a format, otherwise just guess based on the binary data Assumes that mime and filename extension won’t be for a different file format than file.