Compare commits

...

5 Commits

Author SHA1 Message Date
Lovell Fuller
660bbdb1c0 Docs: changelog for #4441 2025-08-22 20:01:46 +01:00
Lovell Fuller
4164705113 Bump devDeps 2025-08-22 20:01:18 +01:00
Bayan Bennett
c01e272db5
TypeScript: Ensure KernelEnum includes linear (#4441) 2025-08-21 09:35:41 +01:00
Lovell Fuller
8607ff2f4a Tests: remove extraneous use of toColourspace 2025-08-18 10:33:32 +01:00
Lovell Fuller
cd337e4de3 Docs: extractChannel output colourspace is b-w or grey16 2025-08-18 10:24:55 +01:00
6 changed files with 11 additions and 3 deletions

View File

@ -61,6 +61,8 @@ 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**:

View File

@ -8,3 +8,7 @@ slug: changelog/v0.34.4
* Ensure `autoOrient` removes existing metadata after shrink-on-load. * Ensure `autoOrient` removes existing metadata after shrink-on-load.
[#4431](https://github.com/lovell/sharp/issues/4431) [#4431](https://github.com/lovell/sharp/issues/4431)
* TypeScript: Ensure `KernelEnum` includes `linear`.
[#4441](https://github.com/lovell/sharp/pull/4441)
[@BayanBennett](https://github.com/BayanBennett)

View File

@ -74,6 +74,8 @@ 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)

1
lib/index.d.ts vendored
View File

@ -1784,6 +1784,7 @@ declare namespace sharp {
interface KernelEnum { interface KernelEnum {
nearest: 'nearest'; nearest: 'nearest';
cubic: 'cubic'; cubic: 'cubic';
linear: 'linear';
mitchell: 'mitchell'; mitchell: 'mitchell';
lanczos2: 'lanczos2'; lanczos2: 'lanczos2';
lanczos3: 'lanczos3'; lanczos3: 'lanczos3';

View File

@ -182,11 +182,11 @@
"license-checker": "^25.0.1", "license-checker": "^25.0.1",
"mocha": "^11.7.1", "mocha": "^11.7.1",
"node-addon-api": "^8.5.0", "node-addon-api": "^8.5.0",
"node-gyp": "^11.2.0", "node-gyp": "^11.4.1",
"nyc": "^17.1.0", "nyc": "^17.1.0",
"semistandard": "^17.0.0", "semistandard": "^17.0.0",
"tar-fs": "^3.1.0", "tar-fs": "^3.1.0",
"tsd": "^0.32.0" "tsd": "^0.33.0"
}, },
"license": "Apache-2.0", "license": "Apache-2.0",
"engines": { "engines": {

View File

@ -82,7 +82,6 @@ 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);