Skip to content

Commit

Permalink
fix: add a warn when cropping larger than the image
Browse files Browse the repository at this point in the history
  • Loading branch information
loiccoyle committed Oct 13, 2024
1 parent 32b6835 commit cc19ef4
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions phomo/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ pub fn crop_imm_centered<I>(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,
Expand Down

0 comments on commit cc19ef4

Please sign in to comment.