From cc19ef411a37278405e440f373aecb0f90fdf06e Mon Sep 17 00:00:00 2001 From: Loic Coyle Date: Mon, 14 Oct 2024 00:40:23 +0200 Subject: [PATCH] fix: add a `warn` when cropping larger than the image --- phomo/src/utils.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/phomo/src/utils.rs b/phomo/src/utils.rs index 369cd4b..1b42ba4 100644 --- a/phomo/src/utils.rs +++ b/phomo/src/utils.rs @@ -11,6 +11,9 @@ pub fn crop_imm_centered(img: &I, width: u32, height: u32) -> SubImage<&I> where I: GenericImageView, { + if width > img.width() || height > img.height() { + warn!("Attempted to crop image to a larger size than the source image"); + } image::imageops::crop_imm( img, (img.width() - width) / 2,