@depup/sharp-cli 5.2.0-depup.0 → 6.0.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/.github/workflows/ci.yml +30 -0
- package/.prettierignore +2 -0
- package/.prettierrc +1 -0
- package/CHANGELOG.md +40 -8
- package/README.md +6 -9
- package/bin/cli.js +5 -5
- package/changes.json +5 -17
- package/cmd/channel-manipulation/bandbool.js +24 -19
- package/cmd/channel-manipulation/ensure-alpha.js +27 -22
- package/cmd/channel-manipulation/extract-channel.js +23 -19
- package/cmd/channel-manipulation/join-channel.js +19 -20
- package/cmd/channel-manipulation/remove-alpha.js +12 -15
- package/cmd/colour-manipulation/greyscale.js +16 -16
- package/cmd/colour-manipulation/pipeline-colourspace.js +26 -22
- package/cmd/colour-manipulation/tint.js +17 -19
- package/cmd/colour-manipulation/tocolourspace.js +22 -21
- package/cmd/compositing/composite.js +133 -102
- package/cmd/operations/affine.js +57 -51
- package/cmd/operations/blur.js +44 -41
- package/cmd/operations/boolean.js +22 -21
- package/cmd/operations/clahe.js +37 -37
- package/cmd/operations/convolve.js +52 -48
- package/cmd/operations/dilate.js +58 -0
- package/cmd/operations/erode.js +58 -0
- package/cmd/operations/flatten.js +23 -24
- package/cmd/operations/flip.js +12 -15
- package/cmd/operations/flop.js +12 -15
- package/cmd/operations/gamma.js +26 -25
- package/cmd/operations/linear.js +30 -29
- package/cmd/operations/median.js +18 -22
- package/cmd/operations/modulate.js +42 -31
- package/cmd/operations/negate.js +17 -20
- package/cmd/operations/normalise.js +28 -25
- package/cmd/operations/recomb.js +34 -32
- package/cmd/operations/rotate.js +31 -29
- package/cmd/operations/sharpen.js +49 -45
- package/cmd/operations/threshold.js +29 -29
- package/cmd/operations/unflatten.js +14 -16
- package/cmd/output.js +61 -56
- package/cmd/resizing/extend.js +55 -49
- package/cmd/resizing/extract.js +32 -33
- package/cmd/resizing/resize.js +79 -56
- package/cmd/resizing/trim.js +59 -36
- package/{lib/queue.js → eslint.config.mjs} +21 -17
- package/lib/cli.js +637 -383
- package/lib/constants.js +24 -18
- package/lib/convert.js +106 -73
- package/lib/index.js +56 -23
- package/lib/utils.js +50 -0
- package/package.json +27 -37
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
push:
|
|
6
|
+
branches:
|
|
7
|
+
- master
|
|
8
|
+
|
|
9
|
+
permissions:
|
|
10
|
+
contents: read
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
test:
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
|
|
16
|
+
steps:
|
|
17
|
+
- name: Check out repository
|
|
18
|
+
uses: actions/checkout@v4
|
|
19
|
+
|
|
20
|
+
- name: Set up Node.js
|
|
21
|
+
uses: actions/setup-node@v4
|
|
22
|
+
with:
|
|
23
|
+
node-version: "20.10.0"
|
|
24
|
+
cache: npm
|
|
25
|
+
|
|
26
|
+
- name: Install dependencies
|
|
27
|
+
run: npm ci
|
|
28
|
+
|
|
29
|
+
- name: Lint and test
|
|
30
|
+
run: npm test
|
package/.prettierignore
ADDED
package/.prettierrc
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{}
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,37 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 6.0.0 (August 21, 2026)
|
|
4
|
+
|
|
5
|
+
- Added [`--limitInputChannels`](https://sharp.pixelplumbing.com/api-constructor/) input option.
|
|
6
|
+
- Added `--dry` option to process images without writing output files.
|
|
7
|
+
- Added [`--exact`](https://sharp.pixelplumbing.com/api-output#webp) output option.
|
|
8
|
+
- Added [`--keepGainMap`](https://sharp.pixelplumbing.com/api-output#keepgainmap) and [`--withGainMap`](https://sharp.pixelplumbing.com/api-output#withgainmap) output options.
|
|
9
|
+
- Added `--print` option to print input and output metadata as JSON ([#48](https://github.com/vseventer/sharp-cli/issues/48)).
|
|
10
|
+
- Added [`--tune`](https://sharp.pixelplumbing.com/api-output#avif) output option.
|
|
11
|
+
- Added [`--withDensity`](https://sharp.pixelplumbing.com/api-output#withdensity) output option.
|
|
12
|
+
- Added [`--margin`](https://sharp.pixelplumbing.com/api-resize#trim) option to the `trim` command.
|
|
13
|
+
- Removed `jpg` output format alias; use `jpeg` instead.
|
|
14
|
+
- Added graceful handling of partial failures during batch image processing ([#98](https://github.com/vseventer/sharp-cli/issues/98)).
|
|
15
|
+
- Fixes bug where format options could cause errors. Consequently, removed `jpg` output format alias; use `jpeg` instead ([#92](https://github.com/vseventer/sharp-cli/issues/92)).
|
|
16
|
+
- Drop `must` dependency in favor of Node.js native `assert`.
|
|
17
|
+
- Internal refactor from CommonJS to ESM.
|
|
18
|
+
- Tightened `yargs` option configuration to require values.
|
|
19
|
+
- Updated `sharp` dependency to 0.35.3.
|
|
20
|
+
- Updated dependencies.
|
|
21
|
+
- Requires Node.js 20.10.
|
|
22
|
+
|
|
23
|
+
## 5.3.0 (August 13, 2026)
|
|
24
|
+
|
|
25
|
+
> Last release compatible with Node.js 18.
|
|
26
|
+
|
|
27
|
+
- Added [`dilate`](https://sharp.pixelplumbing.com/api-operation#dilate) and [`erode`](https://sharp.pixelplumbing.com/api-operation#erode) operations.
|
|
28
|
+
- Added [`--bigtiff`](https://sharp.pixelplumbing.com/api-output#tiff) output option.
|
|
29
|
+
- Added [`--keepDuplicateFrames`](https://sharp.pixelplumbing.com/api-output#gif) output option.
|
|
30
|
+
- Fixes bug where zero (`0`) number option values would be silently ignored (e.g. `--compressionLevel`, `--dither`, `--delay`, or `--effort`).
|
|
31
|
+
- Drop `bubble-stream-error` dependency in favor of Node.js native `stream.pipeline`.
|
|
32
|
+
- Updated `sharp` dependency to 0.34.5.
|
|
33
|
+
- Updated dependencies, including replacing `standard` and `snazzy` with `prettier`.
|
|
34
|
+
|
|
3
35
|
## 5.2.0 (June 24, 2025)
|
|
4
36
|
|
|
5
37
|
- Added [`--autoOrient`, `pdfBackground`](https://sharp.pixelplumbing.com/api-constructor/) input option.
|
|
@@ -156,16 +188,16 @@
|
|
|
156
188
|
|
|
157
189
|
## 1.8.0 (January 5, 2019)
|
|
158
190
|
|
|
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.
|
|
191
|
+
- Added `--background` option to [`resize`](https://sharp.pixelplumbing.com/api-resize#resize) and [`rotate`](https://sharp.pixelplumbing.com/api-operation#rotate) commands.
|
|
192
|
+
- Added [`--fit` and `--position`](https://sharp.pixelplumbing.com/api-resize#resize) options.
|
|
193
|
+
- Added [`--factorOut`](https://sharp.pixelplumbing.com/api-operation#gamma) option.
|
|
194
|
+
- Added [`--pyramid`, `--tileWidth`, and `--tileHeight`](https://sharp.pixelplumbing.com/api-output#tiff) options.
|
|
195
|
+
- Added [`extend`](https://sharp.pixelplumbing.com/api-resize#extend) command.
|
|
196
|
+
- Added [`flatten`](https://sharp.pixelplumbing.com/api-operation#flatten) command.
|
|
197
|
+
- Added [`recomb`](https://sharp.pixelplumbing.com/api-operation#recomb) command.
|
|
166
198
|
- Removed `--crop`, `--ignoreAspectRatio`, `--min`, and `--max` options.
|
|
167
199
|
- Removed `background` command.
|
|
168
|
-
- Renamed `--tolerance` option to [`--threshold`](https://sharp.
|
|
200
|
+
- Renamed `--tolerance` option to [`--threshold`](https://sharp.pixelplumbing.com/api-resize#trim).
|
|
169
201
|
- Updated `sharp` and `sinon` dependencies.
|
|
170
202
|
|
|
171
203
|
## 1.7.2 (December 4, 2018)
|
package/README.md
CHANGED
|
@@ -13,20 +13,17 @@ npm install @depup/sharp-cli
|
|
|
13
13
|
|
|
14
14
|
| Field | Value |
|
|
15
15
|
|-------|-------|
|
|
16
|
-
| Original | [sharp-cli](https://www.npmjs.com/package/sharp-cli) @
|
|
17
|
-
| Processed | 2026-
|
|
18
|
-
| Smoke test |
|
|
19
|
-
| Deps updated |
|
|
16
|
+
| Original | [sharp-cli](https://www.npmjs.com/package/sharp-cli) @ 6.0.0 |
|
|
17
|
+
| Processed | 2026-08-23 |
|
|
18
|
+
| Smoke test | passed |
|
|
19
|
+
| Deps updated | 2 |
|
|
20
20
|
|
|
21
21
|
## Dependency Changes
|
|
22
22
|
|
|
23
23
|
| Dependency | From | To |
|
|
24
24
|
|------------|------|-----|
|
|
25
|
-
| glob |
|
|
26
|
-
|
|
|
27
|
-
| lodash.pick | 3.1.0 | ^4.4.0 |
|
|
28
|
-
| sharp | 0.34.2 | ^0.34.5 |
|
|
29
|
-
| yargs | ^17.6.2 | ^18.0.0 |
|
|
25
|
+
| glob | 13.0.x | ^13.0.6 |
|
|
26
|
+
| yargs | 17.7.x | ^18.1.0 |
|
|
30
27
|
|
|
31
28
|
---
|
|
32
29
|
|
package/bin/cli.js
CHANGED
|
@@ -22,11 +22,11 @@
|
|
|
22
22
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
|
-
// Strict mode.
|
|
26
|
-
'use strict'
|
|
27
|
-
|
|
28
25
|
// Package modules.
|
|
29
|
-
|
|
26
|
+
import { hideBin } from "yargs/helpers";
|
|
27
|
+
|
|
28
|
+
// Local modules.
|
|
29
|
+
import sharp from "../lib/index.js";
|
|
30
30
|
|
|
31
31
|
// Run.
|
|
32
|
-
|
|
32
|
+
sharp(hideBin(process.argv));
|
package/changes.json
CHANGED
|
@@ -1,26 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"bumped": {
|
|
3
3
|
"glob": {
|
|
4
|
-
"from": "
|
|
4
|
+
"from": "13.0.x",
|
|
5
5
|
"to": "^13.0.6"
|
|
6
6
|
},
|
|
7
|
-
"is-directory": {
|
|
8
|
-
"from": "0.3.x",
|
|
9
|
-
"to": "^0.3.1"
|
|
10
|
-
},
|
|
11
|
-
"lodash.pick": {
|
|
12
|
-
"from": "3.1.0",
|
|
13
|
-
"to": "^4.4.0"
|
|
14
|
-
},
|
|
15
|
-
"sharp": {
|
|
16
|
-
"from": "0.34.2",
|
|
17
|
-
"to": "^0.34.5"
|
|
18
|
-
},
|
|
19
7
|
"yargs": {
|
|
20
|
-
"from": "
|
|
21
|
-
"to": "^18.
|
|
8
|
+
"from": "17.7.x",
|
|
9
|
+
"to": "^18.1.0"
|
|
22
10
|
}
|
|
23
11
|
},
|
|
24
|
-
"timestamp": "2026-
|
|
25
|
-
"totalUpdated":
|
|
12
|
+
"timestamp": "2026-08-23T00:28:58.451Z",
|
|
13
|
+
"totalUpdated": 2
|
|
26
14
|
}
|
|
@@ -23,39 +23,44 @@
|
|
|
23
23
|
|
|
24
24
|
// @see https://sharp.pixelplumbing.com/api-channel#bandbool
|
|
25
25
|
|
|
26
|
-
// Strict mode.
|
|
27
|
-
'use strict'
|
|
28
|
-
|
|
29
26
|
// Local modules.
|
|
30
|
-
|
|
31
|
-
const queue = require('../../lib/queue')
|
|
27
|
+
import constants from "../../lib/constants.js";
|
|
32
28
|
|
|
33
29
|
// Configure.
|
|
34
30
|
const positionals = {
|
|
35
31
|
operator: {
|
|
36
32
|
choices: constants.BOOL,
|
|
37
|
-
desc:
|
|
38
|
-
}
|
|
39
|
-
}
|
|
33
|
+
desc: "Operator to perform that bitwise operation",
|
|
34
|
+
},
|
|
35
|
+
};
|
|
40
36
|
|
|
41
37
|
// Command builder.
|
|
42
38
|
const builder = (yargs) => {
|
|
43
39
|
return yargs
|
|
44
40
|
.strict()
|
|
45
|
-
.example(
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
41
|
+
.example(
|
|
42
|
+
"$0 bandbool and",
|
|
43
|
+
"The output will be a single channel image where each pixel `P = R & G & B`",
|
|
44
|
+
)
|
|
45
|
+
.epilog(
|
|
46
|
+
"For more information on available options, please visit https://sharp.pixelplumbing.com/api-channel#bandbool",
|
|
47
|
+
)
|
|
48
|
+
.positional("operator", positionals.operator);
|
|
49
|
+
};
|
|
49
50
|
|
|
50
51
|
// Command handler.
|
|
51
52
|
const handler = (args) => {
|
|
52
|
-
return queue.push([
|
|
53
|
-
|
|
53
|
+
return args["#queue"].push([
|
|
54
|
+
"bandbool",
|
|
55
|
+
(sharp) => sharp.bandbool(args.operator),
|
|
56
|
+
]);
|
|
57
|
+
};
|
|
54
58
|
|
|
55
59
|
// Exports.
|
|
56
|
-
|
|
57
|
-
command:
|
|
58
|
-
describe:
|
|
60
|
+
export default {
|
|
61
|
+
command: "bandbool <operator>",
|
|
62
|
+
describe:
|
|
63
|
+
"Perform a bitwise boolean operation on all input image channels (bands) to produce a single channel output image",
|
|
59
64
|
builder,
|
|
60
|
-
handler
|
|
61
|
-
}
|
|
65
|
+
handler,
|
|
66
|
+
};
|
|
@@ -23,40 +23,45 @@
|
|
|
23
23
|
|
|
24
24
|
// @see https://sharp.pixelplumbing.com/api-channel#ensurealpha
|
|
25
25
|
|
|
26
|
-
// Strict mode.
|
|
27
|
-
'use strict'
|
|
28
|
-
|
|
29
|
-
// Local modules.
|
|
30
|
-
const queue = require('../../lib/queue')
|
|
31
|
-
|
|
32
26
|
// Configure.
|
|
33
27
|
const positionals = {
|
|
34
28
|
alpha: {
|
|
35
29
|
default: 1,
|
|
36
|
-
desc:
|
|
37
|
-
type:
|
|
38
|
-
}
|
|
39
|
-
}
|
|
30
|
+
desc: "Alpha transparency level",
|
|
31
|
+
type: "number",
|
|
32
|
+
},
|
|
33
|
+
};
|
|
40
34
|
|
|
41
35
|
// Command builder.
|
|
42
36
|
const builder = (yargs) => {
|
|
43
37
|
return yargs
|
|
44
38
|
.strict()
|
|
45
|
-
.example(
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
39
|
+
.example(
|
|
40
|
+
"$0 ensureAlpha",
|
|
41
|
+
"The output will be a 4 channel image with a fully-opaque alpha channel",
|
|
42
|
+
)
|
|
43
|
+
.example(
|
|
44
|
+
"$0 ensureAlpha 0",
|
|
45
|
+
"The output will be a 4 channel image with a fully-transparent alpha channel",
|
|
46
|
+
)
|
|
47
|
+
.epilog(
|
|
48
|
+
"For more information on available options, please visit https://sharp.pixelplumbing.com/api-channel#removealpha",
|
|
49
|
+
)
|
|
50
|
+
.positional("alpha", positionals.alpha);
|
|
51
|
+
};
|
|
50
52
|
|
|
51
53
|
// Command handler.
|
|
52
54
|
const handler = (args) => {
|
|
53
|
-
return queue.push([
|
|
54
|
-
|
|
55
|
+
return args["#queue"].push([
|
|
56
|
+
"ensureAlpha",
|
|
57
|
+
(sharp) => sharp.ensureAlpha(args.alpha),
|
|
58
|
+
]);
|
|
59
|
+
};
|
|
55
60
|
|
|
56
61
|
// Exports.
|
|
57
|
-
|
|
58
|
-
command:
|
|
59
|
-
describe:
|
|
62
|
+
export default {
|
|
63
|
+
command: "ensureAlpha [alpha]",
|
|
64
|
+
describe: "Ensure the output image has an alpha transparency channel",
|
|
60
65
|
builder,
|
|
61
|
-
handler
|
|
62
|
-
}
|
|
66
|
+
handler,
|
|
67
|
+
};
|
|
@@ -23,39 +23,43 @@
|
|
|
23
23
|
|
|
24
24
|
// @see https://sharp.pixelplumbing.com/api-channel#extractchannel
|
|
25
25
|
|
|
26
|
-
// Strict mode.
|
|
27
|
-
'use strict'
|
|
28
|
-
|
|
29
26
|
// Local modules.
|
|
30
|
-
|
|
31
|
-
const queue = require('../../lib/queue')
|
|
27
|
+
import constants from "../../lib/constants.js";
|
|
32
28
|
|
|
33
29
|
// Configure.
|
|
34
30
|
const positionals = {
|
|
35
31
|
channel: {
|
|
36
32
|
choices: constants.CHANNEL,
|
|
37
|
-
desc:
|
|
38
|
-
}
|
|
39
|
-
}
|
|
33
|
+
desc: "The channel/band number to extract",
|
|
34
|
+
},
|
|
35
|
+
};
|
|
40
36
|
|
|
41
37
|
// Command builder.
|
|
42
38
|
const builder = (yargs) => {
|
|
43
39
|
return yargs
|
|
44
40
|
.strict()
|
|
45
|
-
.example(
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
41
|
+
.example(
|
|
42
|
+
"$0 extractChannel green",
|
|
43
|
+
"The output will contain the green channel of the input image",
|
|
44
|
+
)
|
|
45
|
+
.epilog(
|
|
46
|
+
"For more information on available options, please visit https://sharp.pixelplumbing.com/api-channel#extractchannel",
|
|
47
|
+
)
|
|
48
|
+
.positional("channel", positionals.channel);
|
|
49
|
+
};
|
|
49
50
|
|
|
50
51
|
// Command handler.
|
|
51
52
|
const handler = (args) => {
|
|
52
|
-
return queue.push([
|
|
53
|
-
|
|
53
|
+
return args["#queue"].push([
|
|
54
|
+
"extractChannel",
|
|
55
|
+
(sharp) => sharp.extractChannel(args.channel),
|
|
56
|
+
]);
|
|
57
|
+
};
|
|
54
58
|
|
|
55
59
|
// Exports.
|
|
56
|
-
|
|
57
|
-
command:
|
|
58
|
-
describe:
|
|
60
|
+
export default {
|
|
61
|
+
command: "extractChannel <channel>",
|
|
62
|
+
describe: "Extract a single channel from a multi-channel image",
|
|
59
63
|
builder,
|
|
60
|
-
handler
|
|
61
|
-
}
|
|
64
|
+
handler,
|
|
65
|
+
};
|
|
@@ -23,38 +23,37 @@
|
|
|
23
23
|
|
|
24
24
|
// @see https://sharp.pixelplumbing.com/api-channel#joinchannel
|
|
25
25
|
|
|
26
|
-
// Strict mode.
|
|
27
|
-
'use strict'
|
|
28
|
-
|
|
29
|
-
// Local modules.
|
|
30
|
-
const queue = require('../../lib/queue')
|
|
31
|
-
|
|
32
26
|
// Configure.
|
|
33
27
|
const positionals = {
|
|
34
28
|
images: {
|
|
35
|
-
desc:
|
|
29
|
+
desc: "One or more images",
|
|
36
30
|
normalize: true,
|
|
37
|
-
type:
|
|
38
|
-
}
|
|
39
|
-
}
|
|
31
|
+
type: "array",
|
|
32
|
+
},
|
|
33
|
+
};
|
|
40
34
|
|
|
41
35
|
// Command builder.
|
|
42
36
|
const builder = (yargs) => {
|
|
43
37
|
return yargs
|
|
44
38
|
.strict()
|
|
45
|
-
.epilog(
|
|
46
|
-
|
|
47
|
-
|
|
39
|
+
.epilog(
|
|
40
|
+
"For more information on available options, please visit https://sharp.pixelplumbing.com/api-channel#joinchannel",
|
|
41
|
+
)
|
|
42
|
+
.positional("images", positionals.images);
|
|
43
|
+
};
|
|
48
44
|
|
|
49
45
|
// Command handler.
|
|
50
46
|
const handler = (args) => {
|
|
51
|
-
return queue.push([
|
|
52
|
-
|
|
47
|
+
return args["#queue"].push([
|
|
48
|
+
"joinChannel",
|
|
49
|
+
(sharp) => sharp.joinChannel(args.images),
|
|
50
|
+
]);
|
|
51
|
+
};
|
|
53
52
|
|
|
54
53
|
// Exports.
|
|
55
|
-
|
|
56
|
-
command:
|
|
57
|
-
describe:
|
|
54
|
+
export default {
|
|
55
|
+
command: "joinChannel <images..>",
|
|
56
|
+
describe: "Join one or more channels to the image",
|
|
58
57
|
builder,
|
|
59
|
-
handler
|
|
60
|
-
}
|
|
58
|
+
handler,
|
|
59
|
+
};
|
|
@@ -23,27 +23,24 @@
|
|
|
23
23
|
|
|
24
24
|
// @see https://sharp.pixelplumbing.com/api-channel#removealpha
|
|
25
25
|
|
|
26
|
-
// Strict mode.
|
|
27
|
-
'use strict'
|
|
28
|
-
|
|
29
|
-
// Local modules.
|
|
30
|
-
const queue = require('../../lib/queue')
|
|
31
|
-
|
|
32
26
|
// Command builder.
|
|
33
27
|
const builder = (yargs) => {
|
|
34
28
|
return yargs
|
|
35
29
|
.strict()
|
|
36
|
-
.example(
|
|
37
|
-
.epilog(
|
|
38
|
-
|
|
30
|
+
.example("$0 removeAlpha", "The output will be without an alpha channel")
|
|
31
|
+
.epilog(
|
|
32
|
+
"For more information on available options, please visit https://sharp.pixelplumbing.com/api-channel#removealpha",
|
|
33
|
+
);
|
|
34
|
+
};
|
|
39
35
|
|
|
40
36
|
// Command handler.
|
|
41
|
-
const handler = (args) =>
|
|
37
|
+
const handler = (args) =>
|
|
38
|
+
args["#queue"].push(["removeAlpha", (sharp) => sharp.removeAlpha()]);
|
|
42
39
|
|
|
43
40
|
// Exports.
|
|
44
|
-
|
|
45
|
-
command:
|
|
46
|
-
describe:
|
|
41
|
+
export default {
|
|
42
|
+
command: "removeAlpha",
|
|
43
|
+
describe: "Remove alpha channel, if any",
|
|
47
44
|
builder,
|
|
48
|
-
handler
|
|
49
|
-
}
|
|
45
|
+
handler,
|
|
46
|
+
};
|
|
@@ -23,28 +23,28 @@
|
|
|
23
23
|
|
|
24
24
|
// @see https://sharp.pixelplumbing.com/api-colour#greyscale
|
|
25
25
|
|
|
26
|
-
// Strict mode.
|
|
27
|
-
'use strict'
|
|
28
|
-
|
|
29
|
-
// Local modules.
|
|
30
|
-
const queue = require('../../lib/queue')
|
|
31
|
-
|
|
32
26
|
// Command builder.
|
|
33
27
|
const builder = (yargs) => {
|
|
34
28
|
return yargs
|
|
35
29
|
.strict()
|
|
36
|
-
.example(
|
|
37
|
-
|
|
38
|
-
|
|
30
|
+
.example(
|
|
31
|
+
"$0 greyscale",
|
|
32
|
+
"The output will contain three identical color channels",
|
|
33
|
+
)
|
|
34
|
+
.epilog(
|
|
35
|
+
"For more information on available options, please visit https://sharp.pixelplumbing.com/api-colour#greyscale",
|
|
36
|
+
);
|
|
37
|
+
};
|
|
39
38
|
|
|
40
39
|
// Command handler.
|
|
41
|
-
const handler = (args) =>
|
|
40
|
+
const handler = (args) =>
|
|
41
|
+
args["#queue"].push(["greyscale", (sharp) => sharp.greyscale()]);
|
|
42
42
|
|
|
43
43
|
// Exports.
|
|
44
|
-
|
|
45
|
-
command:
|
|
46
|
-
aliases:
|
|
47
|
-
describe:
|
|
44
|
+
export default {
|
|
45
|
+
command: "greyscale",
|
|
46
|
+
aliases: "grayscale",
|
|
47
|
+
describe: "Convert to 8-bit greyscale; 256 shades of grey",
|
|
48
48
|
builder,
|
|
49
|
-
handler
|
|
50
|
-
}
|
|
49
|
+
handler,
|
|
50
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* The MIT License (MIT)
|
|
3
3
|
*
|
|
4
|
-
* Copyright (c)
|
|
4
|
+
* Copyright (c) 2019 Mark van Seventer
|
|
5
5
|
*
|
|
6
6
|
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
7
7
|
* this software and associated documentation files (the "Software"), to deal in
|
|
@@ -23,41 +23,45 @@
|
|
|
23
23
|
|
|
24
24
|
// @see https://sharp.pixelplumbing.com/api-colour#tocolourspace
|
|
25
25
|
|
|
26
|
-
// Strict mode.
|
|
27
|
-
'use strict'
|
|
28
|
-
|
|
29
26
|
// Local modules.
|
|
30
|
-
|
|
31
|
-
const queue = require('../../lib/queue')
|
|
27
|
+
import constants from "../../lib/constants.js";
|
|
32
28
|
|
|
33
29
|
// Configure.
|
|
34
30
|
const positionals = {
|
|
35
31
|
colourspace: {
|
|
36
|
-
alias:
|
|
32
|
+
alias: "colorspace",
|
|
37
33
|
choices: constants.COLOURSPACE,
|
|
38
|
-
desc:
|
|
39
|
-
}
|
|
40
|
-
}
|
|
34
|
+
desc: "Pipeline colourspace",
|
|
35
|
+
},
|
|
36
|
+
};
|
|
41
37
|
|
|
42
38
|
// Command builder.
|
|
43
39
|
const builder = (yargs) => {
|
|
44
40
|
return yargs
|
|
45
41
|
.strict()
|
|
46
|
-
.example(
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
42
|
+
.example(
|
|
43
|
+
"$0 pipelineColourspace rgb16",
|
|
44
|
+
"Run the pipeline in 16 bits per channel RGB",
|
|
45
|
+
)
|
|
46
|
+
.epilog(
|
|
47
|
+
"For more information on available options, please visit https://sharp.pixelplumbing.com/api-colour#tocolourspace",
|
|
48
|
+
)
|
|
49
|
+
.positional("colourspacae", positionals.colourspace);
|
|
50
|
+
};
|
|
50
51
|
|
|
51
52
|
// Command handler.
|
|
52
53
|
const handler = (args) => {
|
|
53
|
-
return queue.push([
|
|
54
|
-
|
|
54
|
+
return args["#queue"].push([
|
|
55
|
+
"pipelineColourspace",
|
|
56
|
+
(sharp) => sharp.pipelineColourspace(args.colourspace),
|
|
57
|
+
]);
|
|
58
|
+
};
|
|
55
59
|
|
|
56
60
|
// Exports.
|
|
57
|
-
|
|
58
|
-
command:
|
|
59
|
-
aliases:
|
|
60
|
-
describe:
|
|
61
|
+
export default {
|
|
62
|
+
command: "pipelineColourspace <colourspace>",
|
|
63
|
+
aliases: "pipelineColorspace",
|
|
64
|
+
describe: "Set the pipeline colourspace",
|
|
61
65
|
builder,
|
|
62
|
-
handler
|
|
63
|
-
}
|
|
66
|
+
handler,
|
|
67
|
+
};
|
|
@@ -23,36 +23,34 @@
|
|
|
23
23
|
|
|
24
24
|
// @see https://sharp.pixelplumbing.com/api-colour#tint
|
|
25
25
|
|
|
26
|
-
// Strict mode.
|
|
27
|
-
'use strict'
|
|
28
|
-
|
|
29
|
-
// Local modules.
|
|
30
|
-
const queue = require('../../lib/queue')
|
|
31
|
-
|
|
32
26
|
// Configure.
|
|
33
27
|
const positionals = {
|
|
34
28
|
rgb: {
|
|
35
|
-
desc:
|
|
36
|
-
type:
|
|
37
|
-
}
|
|
38
|
-
}
|
|
29
|
+
desc: "Parsed by the color module to extract chroma values",
|
|
30
|
+
type: "string",
|
|
31
|
+
},
|
|
32
|
+
};
|
|
39
33
|
|
|
40
34
|
// Command builder.
|
|
41
35
|
const builder = (yargs) => {
|
|
42
36
|
return yargs
|
|
43
37
|
.strict()
|
|
44
38
|
.example('$0 tint "rgb(255, 240, 16)"')
|
|
45
|
-
.epilog(
|
|
46
|
-
|
|
47
|
-
|
|
39
|
+
.epilog(
|
|
40
|
+
"For more information on available options, please visit https://sharp.pixelplumbing.com/api-colour#tint",
|
|
41
|
+
)
|
|
42
|
+
.positional("rgb", positionals.rgb);
|
|
43
|
+
};
|
|
48
44
|
|
|
49
45
|
// Command handler.
|
|
50
|
-
const handler = (args) =>
|
|
46
|
+
const handler = (args) =>
|
|
47
|
+
args["#queue"].push(["tint", (sharp) => sharp.tint(args.rgb)]);
|
|
51
48
|
|
|
52
49
|
// Exports.
|
|
53
|
-
|
|
54
|
-
command:
|
|
55
|
-
describe:
|
|
50
|
+
export default {
|
|
51
|
+
command: "tint <rgb>",
|
|
52
|
+
describe:
|
|
53
|
+
"Tint the image using the provided chroma while preserving the image luminance",
|
|
56
54
|
builder,
|
|
57
|
-
handler
|
|
58
|
-
}
|
|
55
|
+
handler,
|
|
56
|
+
};
|