Skip to content

Commit

Permalink
Merge pull request #1817 from Flashover89/Check-dimensions-for-dyn-im…
Browse files Browse the repository at this point in the history
…age-before-resizing

Check dimensions of dynamic image before resizing it
  • Loading branch information
fintelia committed Nov 1, 2022
2 parents 1878c88 + 392798c commit a7026e9
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/dynimage.rs
Expand Up @@ -664,6 +664,9 @@ impl DynamicImage {
/// The image is scaled to the maximum possible size that fits
/// within the bounds specified by `nwidth` and `nheight`.
pub fn resize(&self, nwidth: u32, nheight: u32, filter: imageops::FilterType) -> DynamicImage {
if (nwidth, nheight) == self.dimensions() {
return self.clone();
}
let (width2, height2) =
resize_dimensions(self.width(), self.height(), nwidth, nheight, false);

Expand Down

0 comments on commit a7026e9

Please sign in to comment.