mirror of
https://github.com/lovell/sharp.git
synced 2025-12-19 07:15:08 +01:00
Ensure 16-bit input images embed onto alpha background
Support gamma correction of images with alpha channel Favour shrink over affine when reducing by integral factor
This commit is contained in:
BIN
test/fixtures/expected/embed-16bit-rgba.png
vendored
Normal file
BIN
test/fixtures/expected/embed-16bit-rgba.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 755 B |
BIN
test/fixtures/expected/gamma-alpha.jpg
vendored
BIN
test/fixtures/expected/gamma-alpha.jpg
vendored
Binary file not shown.
|
Before Width: | Height: | Size: 4.1 KiB After Width: | Height: | Size: 4.5 KiB |
@@ -80,6 +80,21 @@ describe('Embed', function() {
|
||||
});
|
||||
});
|
||||
|
||||
it('16-bit PNG with alpha channel onto RGBA', function(done) {
|
||||
sharp(fixtures.inputPngWithTransparency16bit)
|
||||
.resize(32, 16)
|
||||
.embed()
|
||||
.background({r: 0, g: 0, b: 0, a: 0})
|
||||
.toBuffer(function(err, data, info) {
|
||||
if (err) throw err;
|
||||
assert.strictEqual(true, data.length > 0);
|
||||
assert.strictEqual('png', info.format);
|
||||
assert.strictEqual(32, info.width);
|
||||
assert.strictEqual(16, info.height);
|
||||
fixtures.assertSimilar(fixtures.expected('embed-16bit-rgba.png'), data, done);
|
||||
});
|
||||
});
|
||||
|
||||
it('Enlarge and embed', function(done) {
|
||||
sharp(fixtures.inputPngWithOneColor)
|
||||
.embed()
|
||||
|
||||
Reference in New Issue
Block a user