diff --git a/source/image-handler/image-handler.js b/source/image-handler/image-handler.js index 62e1f6b17..b108fe4c3 100644 --- a/source/image-handler/image-handler.js +++ b/source/image-handler/image-handler.js @@ -33,6 +33,13 @@ class ImageHandler { } } + if (request.outputFormat === 'webp') { + const reductionEffortVal = process.env.WEBP_REDUCTION_EFFORT; + if (typeof reductionEffortVal !== "undefined") { + image = sharp(originalImage, { failOnError: false }).webp({reductionEffort: parseInt(reductionEffortVal, 10)}); + } + } + const modifiedImage = await this.applyEdits(image, edits); if (request.outputFormat !== undefined) { modifiedImage.toFormat(request.outputFormat);