Prevent double unpremultiply with some composite blends

This commit is contained in:
Lovell Fuller 2022-03-04 23:17:07 +00:00
parent dd3b78272a
commit 23033e2050
8 changed files with 7 additions and 2 deletions

View File

@ -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.

View File

@ -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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 320 B

After

Width:  |  Height:  |  Size: 320 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 291 B

After

Width:  |  Height:  |  Size: 292 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 292 B

After

Width:  |  Height:  |  Size: 292 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 288 B

After

Width:  |  Height:  |  Size: 286 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 286 B

After

Width:  |  Height:  |  Size: 285 B

View File

@ -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]);
});
});