Ensure extractChannel works with 16-bit images #1330

This commit is contained in:
Lovell Fuller
2018-08-12 20:22:39 +01:00
parent 23a4bc103e
commit d705cffdd6
4 changed files with 18 additions and 1 deletions

View File

@@ -69,6 +69,17 @@ describe('Image channel extraction', function () {
});
});
it('Alpha from 16-bit PNG', function (done) {
const output = fixtures.path('output.extract-alpha-16bit.jpg');
sharp(fixtures.inputPngWithTransparency16bit)
.extractChannel(3)
.toFile(output, function (err, info) {
if (err) throw err;
fixtures.assertMaxColourDistance(output, fixtures.expected('extract-alpha-16bit.jpg'));
done();
});
});
it('Invalid channel number', function () {
assert.throws(function () {
sharp(fixtures.inputJpg)