Respect fastShrinkOnLoad option for WebP input #3516

This commit is contained in:
Lovell Fuller
2023-01-17 09:39:23 +00:00
parent 9f79f80a93
commit c150263ef1
3 changed files with 12 additions and 1 deletions

View File

@@ -205,7 +205,7 @@ class PipelineWorker : public Napi::AsyncWorker {
if (jpegShrinkOnLoad > 1 && static_cast<int>(shrink) == jpegShrinkOnLoad) {
jpegShrinkOnLoad /= 2;
}
} else if (inputImageType == sharp::ImageType::WEBP && shrink > 1.0) {
} else if (inputImageType == sharp::ImageType::WEBP && baton->fastShrinkOnLoad && shrink > 1.0) {
// Avoid upscaling via webp
scale = 1.0 / shrink;
} else if (inputImageType == sharp::ImageType::SVG ||