Skip to main content

read

Function read 

Source
pub fn read(path: impl AsRef<Path>) -> Result<SourceImage>
Expand description

Reads and decodes an image from disk.

The image format is determined from the path’s file extension and must be enabled through the corresponding crate feature. JPEG and PNG support are enabled by default.

§Errors

Returns crate::ErrorKind::FileAccess when the file cannot be opened, crate::ErrorKind::UnsupportedFormat when its format is unavailable, and crate::ErrorKind::Decode when its contents cannot be decoded.