Skip to content

Commit

Permalink
Avoid resizing images when they already have the desired size (#1027)
Browse files Browse the repository at this point in the history
  • Loading branch information
nemphys authored Nov 14, 2024
1 parent 705cfc4 commit 4fcb00e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/utils/image.js
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,11 @@ export class RawImage {
resample = 2,
} = {}) {

// Do nothing if the image already has the desired size
if (this.width === width && this.height === height) {
return this;
}

// Ensure resample method is a string
let resampleMethod = RESAMPLING_MAPPING[resample] ?? resample;

Expand Down Expand Up @@ -742,4 +747,4 @@ export class RawImage {
}
});
}
}
}

0 comments on commit 4fcb00e

Please sign in to comment.