use super::super::{format::*, image::*};
use {
png::*,
std::{fs::*, io, path::*},
};
impl Image {
pub fn new_png_file<PathT>(path: PathT) -> io::Result<Self>
where
PathT: AsRef<Path>,
{
let path = path.as_ref();
let mut decoder = Decoder::new(io::BufReader::new(File::open(path)?));
let info = decoder.read_header_info()?;
Ok(Self::new_file(path, false, ImageFormat::PNG, (info.width, info.height)))
}
}