diff --git a/docs/changelog.md b/docs/changelog.md index 58e80884a..25dbe2cd7 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -4,6 +4,11 @@ Requires libvips v8.12.2 +### v0.30.3 - TBD + +* Prevent double unpremultiply with some composite blend modes (regression in 0.30.2). + [#3118](https://github.com/lovell/sharp/issues/3118) + ### v0.30.2 - 2nd March 2022 * Improve performance and accuracy when compositing multiple images. diff --git a/src/pipeline.cc b/src/pipeline.cc index 2289dd215..a08586050 100644 --- a/src/pipeline.cc +++ b/src/pipeline.cc @@ -354,7 +354,7 @@ class PipelineWorker : public Napi::AsyncWorker { } bool const shouldPremultiplyAlpha = sharp::HasAlpha(image) && - (shouldResize || shouldBlur || shouldConv || shouldSharpen || shouldComposite); + (shouldResize || shouldBlur || shouldConv || shouldSharpen); // Premultiply image alpha channel before all transformations to avoid // dark fringing around bright pixels diff --git a/test/fixtures/expected/composite-multiple.png b/test/fixtures/expected/composite-multiple.png index 2aef0fbde..18671a39b 100644 Binary files a/test/fixtures/expected/composite-multiple.png and b/test/fixtures/expected/composite-multiple.png differ diff --git a/test/fixtures/expected/composite.blend.dest-over.png b/test/fixtures/expected/composite.blend.dest-over.png index a230c331a..f7f7b1eb9 100644 Binary files a/test/fixtures/expected/composite.blend.dest-over.png and b/test/fixtures/expected/composite.blend.dest-over.png differ diff --git a/test/fixtures/expected/composite.blend.over.png b/test/fixtures/expected/composite.blend.over.png index 142e75ecb..8c58c402c 100644 Binary files a/test/fixtures/expected/composite.blend.over.png and b/test/fixtures/expected/composite.blend.over.png differ diff --git a/test/fixtures/expected/composite.blend.saturate.png b/test/fixtures/expected/composite.blend.saturate.png index 86090025a..6c77b7fd2 100644 Binary files a/test/fixtures/expected/composite.blend.saturate.png and b/test/fixtures/expected/composite.blend.saturate.png differ diff --git a/test/fixtures/expected/composite.blend.xor.png b/test/fixtures/expected/composite.blend.xor.png index 755440458..916eaf776 100644 Binary files a/test/fixtures/expected/composite.blend.xor.png and b/test/fixtures/expected/composite.blend.xor.png differ diff --git a/test/unit/extend.js b/test/unit/extend.js index 3d81e3120..1e22df77c 100644 --- a/test/unit/extend.js +++ b/test/unit/extend.js @@ -158,6 +158,6 @@ describe('Extend', function () { }) .raw() .toBuffer(); - assert.deepStrictEqual(Array.from(data), [191, 25, 65, 204, 238, 31, 82, 204]); + assert.deepStrictEqual(Array.from(data), [191, 25, 66, 204, 191, 25, 66, 204]); }); });