use crate::testing_prelude::*;
use image::ImageReader;
#[derive(Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord)]
pub struct ImageSnapshot {
pub width: u32,
pub height: u32,
pub color_type: String,
}
impl ImageSnapshot {
pub fn from_path(path: &Path) -> Option<Self> {
let img = ImageReader::open(path).ok()?.decode().ok()?;
Some(Self {
width: img.width(),
height: img.height(),
color_type: format!("{:?}", img.color()),
})
}
}