Improve docs relating to single-channel raw pixel output

This commit is contained in:
Lovell Fuller
2020-03-01 14:22:49 +00:00
parent 03dad5f2b2
commit 258c9e86eb
7 changed files with 51 additions and 8 deletions

View File

@@ -168,5 +168,19 @@ describe('Raw pixel data', function () {
done();
});
});
it('extract A from RGBA', () =>
sharp(fixtures.inputPngWithTransparency)
.resize(32, 24)
.extractChannel(3)
.toColourspace('b-w')
.raw()
.toBuffer({ resolveWithObject: true })
.then(({ info }) => {
assert.strictEqual('raw', info.format);
assert.strictEqual(1, info.channels);
assert.strictEqual(32 * 24, info.size);
})
);
});
});