From 36dce7114f701ac74491bbdb0a20675707c48194 Mon Sep 17 00:00:00 2001 From: Benjamin Wiederkehr Date: Wed, 20 Nov 2019 10:09:05 +0100 Subject: [PATCH] move background function to relevant operations Replace the deprecated background() function with a separate option of the flatten() operation. This ensures compatibility with sharp v0.22.0. References: - https://github.com/lovell/sharp/issues/1392 - https://sharp.pixelplumbing.com/en/stable/changelog/#v0220-18th-march-2019 --- src/adapters/sharp.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/adapters/sharp.js b/src/adapters/sharp.js index a2634ce..77dcad1 100644 --- a/src/adapters/sharp.js +++ b/src/adapters/sharp.js @@ -13,8 +13,9 @@ module.exports = (imagePath: string) => { .resize(width, null); if (options.background) { - resized = resized.background(options.background) - .flatten(); + resized = resized.flatten({ + background: options.background + }); } if (mime === 'image/jpeg') {