Skip shrink-on-load where one dimension <4px #2653

This commit is contained in:
Lovell Fuller
2021-04-07 21:26:16 +01:00
parent d1ca756bd8
commit ed5d753b89
3 changed files with 27 additions and 1 deletions

View File

@@ -226,7 +226,8 @@ class PipelineWorker : public Napi::AsyncWorker {
if (
xshrink == yshrink && xshrink >= 2 * shrink_on_load_factor &&
(inputImageType == sharp::ImageType::JPEG || inputImageType == sharp::ImageType::WEBP) &&
baton->gamma == 0 && baton->topOffsetPre == -1 && baton->trimThreshold == 0.0
baton->gamma == 0 && baton->topOffsetPre == -1 && baton->trimThreshold == 0.0 &&
image.width() > 3 && image.height() > 3
) {
if (xshrink >= 8 * shrink_on_load_factor) {
xfactor = xfactor / 8;