use crate::{OwnedFrame, PixelFormat, Result};
pub fn decode(path: impl AsRef<std::path::Path>) -> Result<OwnedFrame> {
let image = image::ImageReader::open(path)
.map_err(|error| crate::Error::Unsupported(error.to_string()))?
.decode()
.map_err(|error| crate::Error::Unsupported(error.to_string()))?
.to_rgba8();
let width = image.width() as usize;
let height = image.height() as usize;
OwnedFrame::new(image.into_raw(), width, height, PixelFormat::Rgba8)
}