use std::path::PathBuf; use crate::picture::{Picture, ConversionError}; use crate::context::Context; #[derive(Debug)] pub struct Piece { pic: Picture, scaled_path: PathBuf, thumb_path: PathBuf, } impl Piece { pub fn new(ctx: &Context, pic: Picture) -> Result { let mut conv = pic.convert()?; let scaled_path = conv.get_size(ctx, ctx.options.size_scaled)?; let thumb_path = conv.get_size(ctx, ctx.options.size_thumb)?; Ok(Piece { pic, scaled_path, thumb_path, }) } }