pub fn size<P>(path: P) -> ImageResult<ImageSize>
where
    P: AsRef<Path>,
{
    let file = File::open(path)?;
    let mut reader = BufReader::new(file);

    let mut header = [0; 12];
    reader.read_exact(&mut header)?;

    dispatch_header(&mut reader, &header)
}
/// Get the image size from a local file
///
/// # Arguments
/// * `path` - A local path to the file to parse.
///
/// # Remarks
///
/// Will try to read as little of the file as possible in order to get the
/// proper size information.
///
/// # Error
///
/// This method will return an [`ImageError`] under the following conditions:
///
/// * The header isn't recognized as a supported image format
/// * The data isn't long enough to find the size for the given format
///
/// # Examples
///
/// ```
/// use imagesize::size;
///
/// match size("test/test.webp") {
///     Ok(dim) => {
///         assert_eq!(dim.width, 716);
///         assert_eq!(dim.height, 716);
///     }
///     Err(why) => println!("Error getting size: {:?}", why)
/// }
/// ```
///
/// [`ImageError`]: enum.ImageError.html
Get the image size from a local file
Get the image size from a local file
pub fn size<P>(path: P) -> ImageResult<ImageSize>
where
    P: AsRef<Path>,
{
    let file = File::open(path)?;
    let mut reader = BufReader::new(file);
    let mut header = [0; 12];
    reader.read_exact(&mut header)?;
    dispatch_header(&mut reader, &header)
}
pub fn size < P > ( path : P ) -> ImageResult < ImageSize > where P : AsRef < Path > , { let file = File :: open ( path ) ? ; let mut reader = BufReader :: new ( file ) ; let mut header = [ 0 ; 12 ] ; reader . read_exact ( & mut header ) ? ; dispatch_header ( & mut reader , & header ) }
Get the image size from a local file
Get the image size from a local file
path
P
path
P
remarks
Will try to read as little of the file as possible in order to get the
proper size information.
Will try to read as little of the file as possible in order to get the proper size information .
error
This method will return an [`ImageError`] under the following conditions.

The header isn't recognized as a supported image format
The data isn't long enough to find the size for the given format
This method will return an [ ` ImageError ` ] under the following conditions . The header isn ' t recognized as a supported image format The data isn ' t long enough to find the size for the given format
examples
```
use imagesize::size.



[`ImageError`]: enum.ImageError.html
` ` ` use imagesize :: size . [ ` ImageError ` ] : enum . ImageError . html