@depup/sharp-cli 5.2.0-depup.0 → 5.3.0-depup.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.prettierignore +2 -0
- package/.prettierrc +1 -0
- package/CHANGELOG.md +20 -8
- package/README.md +5 -5
- package/bin/cli.js +3 -3
- package/changes.json +5 -5
- package/cmd/channel-manipulation/bandbool.js +22 -16
- package/cmd/channel-manipulation/ensure-alpha.js +25 -17
- package/cmd/channel-manipulation/extract-channel.js +24 -16
- package/cmd/channel-manipulation/join-channel.js +17 -15
- package/cmd/channel-manipulation/remove-alpha.js +13 -10
- package/cmd/colour-manipulation/greyscale.js +17 -11
- package/cmd/colour-manipulation/pipeline-colourspace.js +26 -18
- package/cmd/colour-manipulation/tint.js +17 -14
- package/cmd/colour-manipulation/tocolourspace.js +23 -18
- package/cmd/compositing/composite.js +127 -99
- package/cmd/operations/affine.js +53 -45
- package/cmd/operations/blur.js +44 -36
- package/cmd/operations/boolean.js +23 -18
- package/cmd/operations/clahe.js +36 -31
- package/cmd/operations/convolve.js +51 -43
- package/cmd/operations/dilate.js +64 -0
- package/cmd/operations/erode.js +64 -0
- package/cmd/operations/flatten.js +24 -19
- package/cmd/operations/flip.js +12 -10
- package/cmd/operations/flop.js +12 -10
- package/cmd/operations/gamma.js +27 -20
- package/cmd/operations/linear.js +31 -24
- package/cmd/operations/median.js +19 -17
- package/cmd/operations/modulate.js +36 -26
- package/cmd/operations/negate.js +18 -15
- package/cmd/operations/normalise.js +27 -20
- package/cmd/operations/recomb.js +35 -27
- package/cmd/operations/rotate.js +32 -24
- package/cmd/operations/sharpen.js +45 -40
- package/cmd/operations/threshold.js +30 -24
- package/cmd/operations/unflatten.js +15 -11
- package/cmd/output.js +59 -51
- package/cmd/resizing/extend.js +56 -44
- package/cmd/resizing/extract.js +33 -28
- package/cmd/resizing/resize.js +80 -51
- package/cmd/resizing/trim.js +50 -31
- package/lib/cli.js +480 -366
- package/lib/constants.js +23 -15
- package/lib/convert.js +47 -52
- package/lib/index.js +23 -19
- package/lib/queue.js +8 -7
- package/package.json +12 -13
package/.prettierignore
ADDED
package/.prettierrc
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{}
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 5.3.0 (August 13, 2026)
|
|
4
|
+
|
|
5
|
+
> Last release compatible with Node.js 18.
|
|
6
|
+
|
|
7
|
+
- Added [`dilate`](https://sharp.pixelplumbing.com/api-operation#dilate) and [`erode`](https://sharp.pixelplumbing.com/api-operation#erode) operations.
|
|
8
|
+
- Added [`--bigtiff`](https://sharp.pixelplumbing.com/api-output#tiff) output option.
|
|
9
|
+
- Added [`--keepDuplicateFrames`](https://sharp.pixelplumbing.com/api-output#gif) output option.
|
|
10
|
+
- Fixes bug where zero (`0`) number option values would be silently ignored (e.g. `--compressionLevel`, `--dither`, `--delay`, or `--effort`).
|
|
11
|
+
- Drop `bubble-stream-error` dependency in favor of Node.js native `stream.pipeline`.
|
|
12
|
+
- Updated `sharp` dependency to 0.34.5.
|
|
13
|
+
- Updated dependencies, including replacing `standard` and `snazzy` with `prettier`.
|
|
14
|
+
|
|
3
15
|
## 5.2.0 (June 24, 2025)
|
|
4
16
|
|
|
5
17
|
- Added [`--autoOrient`, `pdfBackground`](https://sharp.pixelplumbing.com/api-constructor/) input option.
|
|
@@ -156,16 +168,16 @@
|
|
|
156
168
|
|
|
157
169
|
## 1.8.0 (January 5, 2019)
|
|
158
170
|
|
|
159
|
-
- Added `--background` option to [`resize`](https://sharp.
|
|
160
|
-
- Added [`--fit` and `--position`](https://sharp.
|
|
161
|
-
- Added [`--factorOut`](https://sharp.
|
|
162
|
-
- Added [`--pyramid`, `--tileWidth`, and `--tileHeight`](https://sharp.
|
|
163
|
-
- Added [`extend`](https://sharp.
|
|
164
|
-
- Added [`flatten`](https://sharp.
|
|
165
|
-
- Added [`recomb`](https://sharp.
|
|
171
|
+
- Added `--background` option to [`resize`](https://sharp.pixelplumbing.com/api-resize#resize) and [`rotate`](https://sharp.pixelplumbing.com/api-operation#rotate) commands.
|
|
172
|
+
- Added [`--fit` and `--position`](https://sharp.pixelplumbing.com/api-resize#resize) options.
|
|
173
|
+
- Added [`--factorOut`](https://sharp.pixelplumbing.com/api-operation#gamma) option.
|
|
174
|
+
- Added [`--pyramid`, `--tileWidth`, and `--tileHeight`](https://sharp.pixelplumbing.com/api-output#tiff) options.
|
|
175
|
+
- Added [`extend`](https://sharp.pixelplumbing.com/api-resize#extend) command.
|
|
176
|
+
- Added [`flatten`](https://sharp.pixelplumbing.com/api-operation#flatten) command.
|
|
177
|
+
- Added [`recomb`](https://sharp.pixelplumbing.com/api-operation#recomb) command.
|
|
166
178
|
- Removed `--crop`, `--ignoreAspectRatio`, `--min`, and `--max` options.
|
|
167
179
|
- Removed `background` command.
|
|
168
|
-
- Renamed `--tolerance` option to [`--threshold`](https://sharp.
|
|
180
|
+
- Renamed `--tolerance` option to [`--threshold`](https://sharp.pixelplumbing.com/api-resize#trim).
|
|
169
181
|
- Updated `sharp` and `sinon` dependencies.
|
|
170
182
|
|
|
171
183
|
## 1.7.2 (December 4, 2018)
|
package/README.md
CHANGED
|
@@ -13,8 +13,8 @@ npm install @depup/sharp-cli
|
|
|
13
13
|
|
|
14
14
|
| Field | Value |
|
|
15
15
|
|-------|-------|
|
|
16
|
-
| Original | [sharp-cli](https://www.npmjs.com/package/sharp-cli) @ 5.
|
|
17
|
-
| Processed | 2026-
|
|
16
|
+
| Original | [sharp-cli](https://www.npmjs.com/package/sharp-cli) @ 5.3.0 |
|
|
17
|
+
| Processed | 2026-08-16 |
|
|
18
18
|
| Smoke test | failed |
|
|
19
19
|
| Deps updated | 5 |
|
|
20
20
|
|
|
@@ -22,11 +22,11 @@ npm install @depup/sharp-cli
|
|
|
22
22
|
|
|
23
23
|
| Dependency | From | To |
|
|
24
24
|
|------------|------|-----|
|
|
25
|
-
| glob |
|
|
25
|
+
| glob | 10.5.x | ^13.0.6 |
|
|
26
26
|
| is-directory | 0.3.x | ^0.3.1 |
|
|
27
27
|
| lodash.pick | 3.1.0 | ^4.4.0 |
|
|
28
|
-
| sharp | 0.34.
|
|
29
|
-
| yargs | ^17.6.2 | ^18.
|
|
28
|
+
| sharp | 0.34.5 | ^0.35.3 |
|
|
29
|
+
| yargs | ^17.6.2 | ^18.1.0 |
|
|
30
30
|
|
|
31
31
|
---
|
|
32
32
|
|
package/bin/cli.js
CHANGED
|
@@ -23,10 +23,10 @@
|
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
25
|
// Strict mode.
|
|
26
|
-
|
|
26
|
+
"use strict";
|
|
27
27
|
|
|
28
28
|
// Package modules.
|
|
29
|
-
const { hideBin } = require(
|
|
29
|
+
const { hideBin } = require("yargs/helpers");
|
|
30
30
|
|
|
31
31
|
// Run.
|
|
32
|
-
require(
|
|
32
|
+
require("../lib")(hideBin(process.argv));
|
package/changes.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"bumped": {
|
|
3
3
|
"glob": {
|
|
4
|
-
"from": "
|
|
4
|
+
"from": "10.5.x",
|
|
5
5
|
"to": "^13.0.6"
|
|
6
6
|
},
|
|
7
7
|
"is-directory": {
|
|
@@ -13,14 +13,14 @@
|
|
|
13
13
|
"to": "^4.4.0"
|
|
14
14
|
},
|
|
15
15
|
"sharp": {
|
|
16
|
-
"from": "0.34.
|
|
17
|
-
"to": "^0.
|
|
16
|
+
"from": "0.34.5",
|
|
17
|
+
"to": "^0.35.3"
|
|
18
18
|
},
|
|
19
19
|
"yargs": {
|
|
20
20
|
"from": "^17.6.2",
|
|
21
|
-
"to": "^18.
|
|
21
|
+
"to": "^18.1.0"
|
|
22
22
|
}
|
|
23
23
|
},
|
|
24
|
-
"timestamp": "2026-
|
|
24
|
+
"timestamp": "2026-08-16T00:30:09.495Z",
|
|
25
25
|
"totalUpdated": 5
|
|
26
26
|
}
|
|
@@ -24,38 +24,44 @@
|
|
|
24
24
|
// @see https://sharp.pixelplumbing.com/api-channel#bandbool
|
|
25
25
|
|
|
26
26
|
// Strict mode.
|
|
27
|
-
|
|
27
|
+
"use strict";
|
|
28
28
|
|
|
29
29
|
// Local modules.
|
|
30
|
-
const constants = require(
|
|
31
|
-
const queue = require(
|
|
30
|
+
const constants = require("../../lib/constants");
|
|
31
|
+
const queue = require("../../lib/queue");
|
|
32
32
|
|
|
33
33
|
// Configure.
|
|
34
34
|
const positionals = {
|
|
35
35
|
operator: {
|
|
36
36
|
choices: constants.BOOL,
|
|
37
|
-
desc:
|
|
38
|
-
}
|
|
39
|
-
}
|
|
37
|
+
desc: "Operator to perform that bitwise operation",
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
40
|
|
|
41
41
|
// Command builder.
|
|
42
42
|
const builder = (yargs) => {
|
|
43
43
|
return yargs
|
|
44
44
|
.strict()
|
|
45
|
-
.example(
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
45
|
+
.example(
|
|
46
|
+
"$0 bandbool and",
|
|
47
|
+
"The output will be a single channel image where each pixel `P = R & G & B`",
|
|
48
|
+
)
|
|
49
|
+
.epilog(
|
|
50
|
+
"For more information on available options, please visit https://sharp.pixelplumbing.com/api-channel#bandbool",
|
|
51
|
+
)
|
|
52
|
+
.positional("operator", positionals.operator);
|
|
53
|
+
};
|
|
49
54
|
|
|
50
55
|
// Command handler.
|
|
51
56
|
const handler = (args) => {
|
|
52
|
-
return queue.push([
|
|
53
|
-
}
|
|
57
|
+
return queue.push(["bandbool", (sharp) => sharp.bandbool(args.operator)]);
|
|
58
|
+
};
|
|
54
59
|
|
|
55
60
|
// Exports.
|
|
56
61
|
module.exports = {
|
|
57
|
-
command:
|
|
58
|
-
describe:
|
|
62
|
+
command: "bandbool <operator>",
|
|
63
|
+
describe:
|
|
64
|
+
"Perform a bitwise boolean operation on all input image channels (bands) to produce a single channel output image",
|
|
59
65
|
builder,
|
|
60
|
-
handler
|
|
61
|
-
}
|
|
66
|
+
handler,
|
|
67
|
+
};
|
|
@@ -24,39 +24,47 @@
|
|
|
24
24
|
// @see https://sharp.pixelplumbing.com/api-channel#ensurealpha
|
|
25
25
|
|
|
26
26
|
// Strict mode.
|
|
27
|
-
|
|
27
|
+
"use strict";
|
|
28
28
|
|
|
29
29
|
// Local modules.
|
|
30
|
-
const queue = require(
|
|
30
|
+
const queue = require("../../lib/queue");
|
|
31
31
|
|
|
32
32
|
// Configure.
|
|
33
33
|
const positionals = {
|
|
34
34
|
alpha: {
|
|
35
35
|
default: 1,
|
|
36
|
-
desc:
|
|
37
|
-
type:
|
|
38
|
-
}
|
|
39
|
-
}
|
|
36
|
+
desc: "Alpha transparency level",
|
|
37
|
+
type: "number",
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
40
|
|
|
41
41
|
// Command builder.
|
|
42
42
|
const builder = (yargs) => {
|
|
43
43
|
return yargs
|
|
44
44
|
.strict()
|
|
45
|
-
.example(
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
45
|
+
.example(
|
|
46
|
+
"$0 ensureAlpha",
|
|
47
|
+
"The output will be a 4 channel image with a fully-opaque alpha channel",
|
|
48
|
+
)
|
|
49
|
+
.example(
|
|
50
|
+
"$0 ensureAlpha 0",
|
|
51
|
+
"The output will be a 4 channel image with a fully-transparent alpha channel",
|
|
52
|
+
)
|
|
53
|
+
.epilog(
|
|
54
|
+
"For more information on available options, please visit https://sharp.pixelplumbing.com/api-channel#removealpha",
|
|
55
|
+
)
|
|
56
|
+
.positional("alpha", positionals.alpha);
|
|
57
|
+
};
|
|
50
58
|
|
|
51
59
|
// Command handler.
|
|
52
60
|
const handler = (args) => {
|
|
53
|
-
return queue.push([
|
|
54
|
-
}
|
|
61
|
+
return queue.push(["ensureAlpha", (sharp) => sharp.ensureAlpha(args.alpha)]);
|
|
62
|
+
};
|
|
55
63
|
|
|
56
64
|
// Exports.
|
|
57
65
|
module.exports = {
|
|
58
|
-
command:
|
|
59
|
-
describe:
|
|
66
|
+
command: "ensureAlpha [alpha]",
|
|
67
|
+
describe: "Ensure the output image has an alpha transparency channel",
|
|
60
68
|
builder,
|
|
61
|
-
handler
|
|
62
|
-
}
|
|
69
|
+
handler,
|
|
70
|
+
};
|
|
@@ -24,38 +24,46 @@
|
|
|
24
24
|
// @see https://sharp.pixelplumbing.com/api-channel#extractchannel
|
|
25
25
|
|
|
26
26
|
// Strict mode.
|
|
27
|
-
|
|
27
|
+
"use strict";
|
|
28
28
|
|
|
29
29
|
// Local modules.
|
|
30
|
-
const constants = require(
|
|
31
|
-
const queue = require(
|
|
30
|
+
const constants = require("../../lib/constants");
|
|
31
|
+
const queue = require("../../lib/queue");
|
|
32
32
|
|
|
33
33
|
// Configure.
|
|
34
34
|
const positionals = {
|
|
35
35
|
channel: {
|
|
36
36
|
choices: constants.CHANNEL,
|
|
37
|
-
desc:
|
|
38
|
-
}
|
|
39
|
-
}
|
|
37
|
+
desc: "The channel/band number to extract",
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
40
|
|
|
41
41
|
// Command builder.
|
|
42
42
|
const builder = (yargs) => {
|
|
43
43
|
return yargs
|
|
44
44
|
.strict()
|
|
45
|
-
.example(
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
45
|
+
.example(
|
|
46
|
+
"$0 extractChannel green",
|
|
47
|
+
"The output will contain the green channel of the input image",
|
|
48
|
+
)
|
|
49
|
+
.epilog(
|
|
50
|
+
"For more information on available options, please visit https://sharp.pixelplumbing.com/api-channel#extractchannel",
|
|
51
|
+
)
|
|
52
|
+
.positional("channel", positionals.channel);
|
|
53
|
+
};
|
|
49
54
|
|
|
50
55
|
// Command handler.
|
|
51
56
|
const handler = (args) => {
|
|
52
|
-
return queue.push([
|
|
53
|
-
|
|
57
|
+
return queue.push([
|
|
58
|
+
"extractChannel",
|
|
59
|
+
(sharp) => sharp.extractChannel(args.channel),
|
|
60
|
+
]);
|
|
61
|
+
};
|
|
54
62
|
|
|
55
63
|
// Exports.
|
|
56
64
|
module.exports = {
|
|
57
|
-
command:
|
|
58
|
-
describe:
|
|
65
|
+
command: "extractChannel <channel>",
|
|
66
|
+
describe: "Extract a single channel from a multi-channel image",
|
|
59
67
|
builder,
|
|
60
|
-
handler
|
|
61
|
-
}
|
|
68
|
+
handler,
|
|
69
|
+
};
|
|
@@ -24,37 +24,39 @@
|
|
|
24
24
|
// @see https://sharp.pixelplumbing.com/api-channel#joinchannel
|
|
25
25
|
|
|
26
26
|
// Strict mode.
|
|
27
|
-
|
|
27
|
+
"use strict";
|
|
28
28
|
|
|
29
29
|
// Local modules.
|
|
30
|
-
const queue = require(
|
|
30
|
+
const queue = require("../../lib/queue");
|
|
31
31
|
|
|
32
32
|
// Configure.
|
|
33
33
|
const positionals = {
|
|
34
34
|
images: {
|
|
35
|
-
desc:
|
|
35
|
+
desc: "One or more images",
|
|
36
36
|
normalize: true,
|
|
37
|
-
type:
|
|
38
|
-
}
|
|
39
|
-
}
|
|
37
|
+
type: "array",
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
40
|
|
|
41
41
|
// Command builder.
|
|
42
42
|
const builder = (yargs) => {
|
|
43
43
|
return yargs
|
|
44
44
|
.strict()
|
|
45
|
-
.epilog(
|
|
46
|
-
|
|
47
|
-
|
|
45
|
+
.epilog(
|
|
46
|
+
"For more information on available options, please visit https://sharp.pixelplumbing.com/api-channel#joinchannel",
|
|
47
|
+
)
|
|
48
|
+
.positional("images", positionals.images);
|
|
49
|
+
};
|
|
48
50
|
|
|
49
51
|
// Command handler.
|
|
50
52
|
const handler = (args) => {
|
|
51
|
-
return queue.push([
|
|
52
|
-
}
|
|
53
|
+
return queue.push(["joinChannel", (sharp) => sharp.joinChannel(args.images)]);
|
|
54
|
+
};
|
|
53
55
|
|
|
54
56
|
// Exports.
|
|
55
57
|
module.exports = {
|
|
56
|
-
command:
|
|
57
|
-
describe:
|
|
58
|
+
command: "joinChannel <images..>",
|
|
59
|
+
describe: "Join one or more channels to the image",
|
|
58
60
|
builder,
|
|
59
|
-
handler
|
|
60
|
-
}
|
|
61
|
+
handler,
|
|
62
|
+
};
|
|
@@ -24,26 +24,29 @@
|
|
|
24
24
|
// @see https://sharp.pixelplumbing.com/api-channel#removealpha
|
|
25
25
|
|
|
26
26
|
// Strict mode.
|
|
27
|
-
|
|
27
|
+
"use strict";
|
|
28
28
|
|
|
29
29
|
// Local modules.
|
|
30
|
-
const queue = require(
|
|
30
|
+
const queue = require("../../lib/queue");
|
|
31
31
|
|
|
32
32
|
// Command builder.
|
|
33
33
|
const builder = (yargs) => {
|
|
34
34
|
return yargs
|
|
35
35
|
.strict()
|
|
36
|
-
.example(
|
|
37
|
-
.epilog(
|
|
38
|
-
|
|
36
|
+
.example("$0 removeAlpha", "The output will be without an alpha channel")
|
|
37
|
+
.epilog(
|
|
38
|
+
"For more information on available options, please visit https://sharp.pixelplumbing.com/api-channel#removealpha",
|
|
39
|
+
);
|
|
40
|
+
};
|
|
39
41
|
|
|
40
42
|
// Command handler.
|
|
41
|
-
const handler = (args) =>
|
|
43
|
+
const handler = (args) =>
|
|
44
|
+
queue.push(["removeAlpha", (sharp) => sharp.removeAlpha()]);
|
|
42
45
|
|
|
43
46
|
// Exports.
|
|
44
47
|
module.exports = {
|
|
45
|
-
command:
|
|
46
|
-
describe:
|
|
48
|
+
command: "removeAlpha",
|
|
49
|
+
describe: "Remove alpha channel, if any",
|
|
47
50
|
builder,
|
|
48
|
-
handler
|
|
49
|
-
}
|
|
51
|
+
handler,
|
|
52
|
+
};
|
|
@@ -24,27 +24,33 @@
|
|
|
24
24
|
// @see https://sharp.pixelplumbing.com/api-colour#greyscale
|
|
25
25
|
|
|
26
26
|
// Strict mode.
|
|
27
|
-
|
|
27
|
+
"use strict";
|
|
28
28
|
|
|
29
29
|
// Local modules.
|
|
30
|
-
const queue = require(
|
|
30
|
+
const queue = require("../../lib/queue");
|
|
31
31
|
|
|
32
32
|
// Command builder.
|
|
33
33
|
const builder = (yargs) => {
|
|
34
34
|
return yargs
|
|
35
35
|
.strict()
|
|
36
|
-
.example(
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
.example(
|
|
37
|
+
"$0 greyscale",
|
|
38
|
+
"The output will contain three identical color channels",
|
|
39
|
+
)
|
|
40
|
+
.epilog(
|
|
41
|
+
"For more information on available options, please visit https://sharp.pixelplumbing.com/api-colour#greyscale",
|
|
42
|
+
);
|
|
43
|
+
};
|
|
39
44
|
|
|
40
45
|
// Command handler.
|
|
41
|
-
const handler = (args) =>
|
|
46
|
+
const handler = (args) =>
|
|
47
|
+
queue.push(["greyscale", (sharp) => sharp.greyscale()]);
|
|
42
48
|
|
|
43
49
|
// Exports.
|
|
44
50
|
module.exports = {
|
|
45
|
-
command:
|
|
46
|
-
aliases:
|
|
47
|
-
describe:
|
|
51
|
+
command: "greyscale",
|
|
52
|
+
aliases: "grayscale",
|
|
53
|
+
describe: "Convert to 8-bit greyscale; 256 shades of grey",
|
|
48
54
|
builder,
|
|
49
|
-
handler
|
|
50
|
-
}
|
|
55
|
+
handler,
|
|
56
|
+
};
|
|
@@ -24,40 +24,48 @@
|
|
|
24
24
|
// @see https://sharp.pixelplumbing.com/api-colour#tocolourspace
|
|
25
25
|
|
|
26
26
|
// Strict mode.
|
|
27
|
-
|
|
27
|
+
"use strict";
|
|
28
28
|
|
|
29
29
|
// Local modules.
|
|
30
|
-
const constants = require(
|
|
31
|
-
const queue = require(
|
|
30
|
+
const constants = require("../../lib/constants");
|
|
31
|
+
const queue = require("../../lib/queue");
|
|
32
32
|
|
|
33
33
|
// Configure.
|
|
34
34
|
const positionals = {
|
|
35
35
|
colourspace: {
|
|
36
|
-
alias:
|
|
36
|
+
alias: "colorspace",
|
|
37
37
|
choices: constants.COLOURSPACE,
|
|
38
|
-
desc:
|
|
39
|
-
}
|
|
40
|
-
}
|
|
38
|
+
desc: "Pipeline colourspace",
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
41
|
|
|
42
42
|
// Command builder.
|
|
43
43
|
const builder = (yargs) => {
|
|
44
44
|
return yargs
|
|
45
45
|
.strict()
|
|
46
|
-
.example(
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
46
|
+
.example(
|
|
47
|
+
"$0 pipelineColourspace rgb16",
|
|
48
|
+
"Run the pipeline in 16 bits per channel RGB",
|
|
49
|
+
)
|
|
50
|
+
.epilog(
|
|
51
|
+
"For more information on available options, please visit https://sharp.pixelplumbing.com/api-colour#tocolourspace",
|
|
52
|
+
)
|
|
53
|
+
.positional("colourspacae", positionals.colourspace);
|
|
54
|
+
};
|
|
50
55
|
|
|
51
56
|
// Command handler.
|
|
52
57
|
const handler = (args) => {
|
|
53
|
-
return queue.push([
|
|
54
|
-
|
|
58
|
+
return queue.push([
|
|
59
|
+
"pipelineColourspace",
|
|
60
|
+
(sharp) => sharp.pipelineColourspace(args.colourspace),
|
|
61
|
+
]);
|
|
62
|
+
};
|
|
55
63
|
|
|
56
64
|
// Exports.
|
|
57
65
|
module.exports = {
|
|
58
|
-
command:
|
|
59
|
-
aliases:
|
|
60
|
-
describe:
|
|
66
|
+
command: "pipelineColourspace <colourspace>",
|
|
67
|
+
aliases: "pipelineColorspace",
|
|
68
|
+
describe: "Set the pipeline colourspace",
|
|
61
69
|
builder,
|
|
62
|
-
handler
|
|
63
|
-
}
|
|
70
|
+
handler,
|
|
71
|
+
};
|
|
@@ -24,35 +24,38 @@
|
|
|
24
24
|
// @see https://sharp.pixelplumbing.com/api-colour#tint
|
|
25
25
|
|
|
26
26
|
// Strict mode.
|
|
27
|
-
|
|
27
|
+
"use strict";
|
|
28
28
|
|
|
29
29
|
// Local modules.
|
|
30
|
-
const queue = require(
|
|
30
|
+
const queue = require("../../lib/queue");
|
|
31
31
|
|
|
32
32
|
// Configure.
|
|
33
33
|
const positionals = {
|
|
34
34
|
rgb: {
|
|
35
|
-
desc:
|
|
36
|
-
type:
|
|
37
|
-
}
|
|
38
|
-
}
|
|
35
|
+
desc: "Parsed by the color module to extract chroma values",
|
|
36
|
+
type: "string",
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
39
|
|
|
40
40
|
// Command builder.
|
|
41
41
|
const builder = (yargs) => {
|
|
42
42
|
return yargs
|
|
43
43
|
.strict()
|
|
44
44
|
.example('$0 tint "rgb(255, 240, 16)"')
|
|
45
|
-
.epilog(
|
|
46
|
-
|
|
47
|
-
|
|
45
|
+
.epilog(
|
|
46
|
+
"For more information on available options, please visit https://sharp.pixelplumbing.com/api-colour#tint",
|
|
47
|
+
)
|
|
48
|
+
.positional("rgb", positionals.rgb);
|
|
49
|
+
};
|
|
48
50
|
|
|
49
51
|
// Command handler.
|
|
50
|
-
const handler = (args) => queue.push([
|
|
52
|
+
const handler = (args) => queue.push(["tint", (sharp) => sharp.tint(args.rgb)]);
|
|
51
53
|
|
|
52
54
|
// Exports.
|
|
53
55
|
module.exports = {
|
|
54
|
-
command:
|
|
55
|
-
describe:
|
|
56
|
+
command: "tint <rgb>",
|
|
57
|
+
describe:
|
|
58
|
+
"Tint the image using the provided chroma while preserving the image luminance",
|
|
56
59
|
builder,
|
|
57
|
-
handler
|
|
58
|
-
}
|
|
60
|
+
handler,
|
|
61
|
+
};
|
|
@@ -24,40 +24,45 @@
|
|
|
24
24
|
// @see https://sharp.pixelplumbing.com/api-colour#tocolourspace
|
|
25
25
|
|
|
26
26
|
// Strict mode.
|
|
27
|
-
|
|
27
|
+
"use strict";
|
|
28
28
|
|
|
29
29
|
// Local modules.
|
|
30
|
-
const constants = require(
|
|
31
|
-
const queue = require(
|
|
30
|
+
const constants = require("../../lib/constants");
|
|
31
|
+
const queue = require("../../lib/queue");
|
|
32
32
|
|
|
33
33
|
// Configure.
|
|
34
34
|
const positionals = {
|
|
35
35
|
colourspace: {
|
|
36
36
|
choices: constants.COLOURSPACE,
|
|
37
|
-
default:
|
|
38
|
-
desc:
|
|
39
|
-
}
|
|
40
|
-
}
|
|
37
|
+
default: "srgb",
|
|
38
|
+
desc: "The output colourspace",
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
41
|
|
|
42
42
|
// Command builder.
|
|
43
43
|
const builder = (yargs) => {
|
|
44
44
|
return yargs
|
|
45
45
|
.strict()
|
|
46
|
-
.example(
|
|
47
|
-
.epilog(
|
|
48
|
-
|
|
49
|
-
|
|
46
|
+
.example("$0 toColourspace rgb16", "Output 16 bits per pixel RGB")
|
|
47
|
+
.epilog(
|
|
48
|
+
"For more information on available options, please visit https://sharp.pixelplumbing.com/api-colour#tocolourspace",
|
|
49
|
+
)
|
|
50
|
+
.positional("colourspace", positionals.colourspace);
|
|
51
|
+
};
|
|
50
52
|
|
|
51
53
|
// Command handler.
|
|
52
54
|
const handler = (args) => {
|
|
53
|
-
return queue.push([
|
|
54
|
-
|
|
55
|
+
return queue.push([
|
|
56
|
+
"toColourspace",
|
|
57
|
+
(sharp) => sharp.toColourspace(args.colourspace),
|
|
58
|
+
]);
|
|
59
|
+
};
|
|
55
60
|
|
|
56
61
|
// Exports.
|
|
57
62
|
module.exports = {
|
|
58
|
-
command:
|
|
59
|
-
aliases:
|
|
60
|
-
describe:
|
|
63
|
+
command: "toColourspace <colourspace>",
|
|
64
|
+
aliases: "toColorspace",
|
|
65
|
+
describe: "Set the output colourspace",
|
|
61
66
|
builder,
|
|
62
|
-
handler
|
|
63
|
-
}
|
|
67
|
+
handler,
|
|
68
|
+
};
|