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:
Lovell Fuller
2016-01-30 22:23:17 +00:00
parent 41e50770d1
commit 2675b2265b
10 changed files with 70 additions and 15 deletions

View File

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