mirror of
https://github.com/lovell/sharp.git
synced 2025-08-24 13:41:39 +02:00
Compare commits
No commits in common. "8607ff2f4a5d0f523f57c589378256a626b62c97" and "51d1a49abceb224d8e9d7122f54819904109d581" have entirely different histories.
8607ff2f4a
...
51d1a49abc
@ -61,8 +61,6 @@ const rgba = await sharp(rgb)
|
|||||||
|
|
||||||
Extract a single channel from a multi-channel image.
|
Extract a single channel from a multi-channel image.
|
||||||
|
|
||||||
The output colourspace will be either `b-w` (8-bit) or `grey16` (16-bit).
|
|
||||||
|
|
||||||
|
|
||||||
**Throws**:
|
**Throws**:
|
||||||
|
|
||||||
|
@ -74,8 +74,6 @@ function ensureAlpha (alpha) {
|
|||||||
/**
|
/**
|
||||||
* Extract a single channel from a multi-channel image.
|
* Extract a single channel from a multi-channel image.
|
||||||
*
|
*
|
||||||
* The output colourspace will be either `b-w` (8-bit) or `grey16` (16-bit).
|
|
||||||
*
|
|
||||||
* @example
|
* @example
|
||||||
* // green.jpg is a greyscale image containing the green channel of the input
|
* // green.jpg is a greyscale image containing the green channel of the input
|
||||||
* await sharp(input)
|
* await sharp(input)
|
||||||
|
@ -82,6 +82,7 @@ describe('Image channel extraction', function () {
|
|||||||
const output = fixtures.path('output.extract-alpha-2-channel.png');
|
const output = fixtures.path('output.extract-alpha-2-channel.png');
|
||||||
sharp(fixtures.inputPngWithGreyAlpha)
|
sharp(fixtures.inputPngWithGreyAlpha)
|
||||||
.extractChannel('alpha')
|
.extractChannel('alpha')
|
||||||
|
.toColourspace('b-w')
|
||||||
.toFile(output, function (err, info) {
|
.toFile(output, function (err, info) {
|
||||||
if (err) throw err;
|
if (err) throw err;
|
||||||
assert.strictEqual(1, info.channels);
|
assert.strictEqual(1, info.channels);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user