@depup/sharp-cli 5.3.0-depup.0 → 6.1.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/CHANGELOG.md +26 -0
- package/README.md +6 -9
- package/bin/cli.js +5 -5
- package/changes.json +4 -16
- package/cmd/channel-manipulation/bandbool.js +6 -7
- package/cmd/channel-manipulation/ensure-alpha.js +5 -8
- package/cmd/channel-manipulation/extract-channel.js +3 -7
- package/cmd/channel-manipulation/join-channel.js +5 -8
- package/cmd/channel-manipulation/remove-alpha.js +2 -8
- package/cmd/colour-manipulation/greyscale.js +2 -8
- package/cmd/colour-manipulation/pipeline-colourspace.js +4 -8
- package/cmd/colour-manipulation/tint.js +3 -8
- package/cmd/colour-manipulation/tocolourspace.js +3 -7
- package/cmd/compositing/composite.js +10 -7
- package/cmd/operations/affine.js +9 -11
- package/cmd/operations/blur.js +3 -8
- package/cmd/operations/boolean.js +3 -7
- package/cmd/operations/clahe.js +4 -9
- package/cmd/operations/convolve.js +5 -9
- package/cmd/operations/dilate.js +2 -8
- package/cmd/operations/erode.js +2 -8
- package/cmd/operations/flatten.js +2 -8
- package/cmd/operations/flip.js +3 -8
- package/cmd/operations/flop.js +3 -8
- package/cmd/operations/gamma.js +2 -8
- package/cmd/operations/linear.js +2 -8
- package/cmd/operations/median.js +2 -8
- package/cmd/operations/modulate.js +10 -9
- package/cmd/operations/negate.js +2 -8
- package/cmd/operations/normalise.js +5 -9
- package/cmd/operations/recomb.js +2 -8
- package/cmd/operations/rotate.js +2 -8
- package/cmd/operations/sharpen.js +8 -9
- package/cmd/operations/threshold.js +2 -8
- package/cmd/operations/unflatten.js +2 -8
- package/cmd/output.js +7 -10
- package/cmd/resizing/extend.js +4 -10
- package/cmd/resizing/extract.js +3 -9
- package/cmd/resizing/resize.js +30 -16
- package/cmd/resizing/trim.js +12 -8
- package/{lib/queue.js → eslint.config.mjs} +20 -17
- package/lib/cli.js +473 -333
- package/lib/constants.js +4 -6
- package/lib/convert.js +120 -56
- package/lib/index.js +46 -17
- package/lib/utils.js +50 -0
- package/package.json +32 -34
|
@@ -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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 6.1.0 (August 31, 2026)
|
|
4
|
+
|
|
5
|
+
- Added a `{path}` output template for preserving directories matched by glob inputs ([#43](https://github.com/vseventer/sharp-cli/issues/43)).
|
|
6
|
+
- Added percentage-based dimensions to the `resize` command ([#49](https://github.com/vseventer/sharp-cli/issues/49)).
|
|
7
|
+
- Updated `sharp` dependency to 0.35.4.
|
|
8
|
+
|
|
9
|
+
## 6.0.0 (August 21, 2026)
|
|
10
|
+
|
|
11
|
+
- Added [`--limitInputChannels`](https://sharp.pixelplumbing.com/api-constructor/) input option.
|
|
12
|
+
- Added `--dry` option to process images without writing output files.
|
|
13
|
+
- Added [`--exact`](https://sharp.pixelplumbing.com/api-output#webp) output option.
|
|
14
|
+
- Added [`--keepGainMap`](https://sharp.pixelplumbing.com/api-output#keepgainmap) and [`--withGainMap`](https://sharp.pixelplumbing.com/api-output#withgainmap) output options.
|
|
15
|
+
- Added `--print` option to print input and output metadata as JSON ([#48](https://github.com/vseventer/sharp-cli/issues/48)).
|
|
16
|
+
- Added [`--tune`](https://sharp.pixelplumbing.com/api-output#avif) output option.
|
|
17
|
+
- Added [`--withDensity`](https://sharp.pixelplumbing.com/api-output#withdensity) output option.
|
|
18
|
+
- Added [`--margin`](https://sharp.pixelplumbing.com/api-resize#trim) option to the `trim` command.
|
|
19
|
+
- Removed `jpg` output format alias; use `jpeg` instead.
|
|
20
|
+
- Added graceful handling of partial failures during batch image processing ([#98](https://github.com/vseventer/sharp-cli/issues/98)).
|
|
21
|
+
- 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)).
|
|
22
|
+
- Drop `must` dependency in favor of Node.js native `assert`.
|
|
23
|
+
- Internal refactor from CommonJS to ESM.
|
|
24
|
+
- Tightened `yargs` option configuration to require values.
|
|
25
|
+
- Updated `sharp` dependency to 0.35.3.
|
|
26
|
+
- Updated dependencies.
|
|
27
|
+
- Requires Node.js 20.10.
|
|
28
|
+
|
|
3
29
|
## 5.3.0 (August 13, 2026)
|
|
4
30
|
|
|
5
31
|
> Last release compatible with Node.js 18.
|
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.1.0 |
|
|
17
|
+
| Processed | 2026-09-06 |
|
|
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.5 | ^0.35.3 |
|
|
29
|
-
| yargs | ^17.6.2 | ^18.1.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.5",
|
|
17
|
-
"to": "^0.35.3"
|
|
18
|
-
},
|
|
19
7
|
"yargs": {
|
|
20
|
-
"from": "
|
|
8
|
+
"from": "17.7.x",
|
|
21
9
|
"to": "^18.1.0"
|
|
22
10
|
}
|
|
23
11
|
},
|
|
24
|
-
"timestamp": "2026-
|
|
25
|
-
"totalUpdated":
|
|
12
|
+
"timestamp": "2026-09-06T01:03:46.036Z",
|
|
13
|
+
"totalUpdated": 2
|
|
26
14
|
}
|
|
@@ -23,12 +23,8 @@
|
|
|
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 = {
|
|
@@ -54,11 +50,14 @@ const builder = (yargs) => {
|
|
|
54
50
|
|
|
55
51
|
// Command handler.
|
|
56
52
|
const handler = (args) => {
|
|
57
|
-
return queue.push([
|
|
53
|
+
return args["#queue"].push([
|
|
54
|
+
"bandbool",
|
|
55
|
+
(sharp) => sharp.bandbool(args.operator),
|
|
56
|
+
]);
|
|
58
57
|
};
|
|
59
58
|
|
|
60
59
|
// Exports.
|
|
61
|
-
|
|
60
|
+
export default {
|
|
62
61
|
command: "bandbool <operator>",
|
|
63
62
|
describe:
|
|
64
63
|
"Perform a bitwise boolean operation on all input image channels (bands) to produce a single channel output image",
|
|
@@ -23,12 +23,6 @@
|
|
|
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: {
|
|
@@ -58,11 +52,14 @@ const builder = (yargs) => {
|
|
|
58
52
|
|
|
59
53
|
// Command handler.
|
|
60
54
|
const handler = (args) => {
|
|
61
|
-
return queue.push([
|
|
55
|
+
return args["#queue"].push([
|
|
56
|
+
"ensureAlpha",
|
|
57
|
+
(sharp) => sharp.ensureAlpha(args.alpha),
|
|
58
|
+
]);
|
|
62
59
|
};
|
|
63
60
|
|
|
64
61
|
// Exports.
|
|
65
|
-
|
|
62
|
+
export default {
|
|
66
63
|
command: "ensureAlpha [alpha]",
|
|
67
64
|
describe: "Ensure the output image has an alpha transparency channel",
|
|
68
65
|
builder,
|
|
@@ -23,12 +23,8 @@
|
|
|
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 = {
|
|
@@ -54,14 +50,14 @@ const builder = (yargs) => {
|
|
|
54
50
|
|
|
55
51
|
// Command handler.
|
|
56
52
|
const handler = (args) => {
|
|
57
|
-
return queue.push([
|
|
53
|
+
return args["#queue"].push([
|
|
58
54
|
"extractChannel",
|
|
59
55
|
(sharp) => sharp.extractChannel(args.channel),
|
|
60
56
|
]);
|
|
61
57
|
};
|
|
62
58
|
|
|
63
59
|
// Exports.
|
|
64
|
-
|
|
60
|
+
export default {
|
|
65
61
|
command: "extractChannel <channel>",
|
|
66
62
|
describe: "Extract a single channel from a multi-channel image",
|
|
67
63
|
builder,
|
|
@@ -23,12 +23,6 @@
|
|
|
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: {
|
|
@@ -50,11 +44,14 @@ const builder = (yargs) => {
|
|
|
50
44
|
|
|
51
45
|
// Command handler.
|
|
52
46
|
const handler = (args) => {
|
|
53
|
-
return queue.push([
|
|
47
|
+
return args["#queue"].push([
|
|
48
|
+
"joinChannel",
|
|
49
|
+
(sharp) => sharp.joinChannel(args.images),
|
|
50
|
+
]);
|
|
54
51
|
};
|
|
55
52
|
|
|
56
53
|
// Exports.
|
|
57
|
-
|
|
54
|
+
export default {
|
|
58
55
|
command: "joinChannel <images..>",
|
|
59
56
|
describe: "Join one or more channels to the image",
|
|
60
57
|
builder,
|
|
@@ -23,12 +23,6 @@
|
|
|
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
|
|
@@ -41,10 +35,10 @@ const builder = (yargs) => {
|
|
|
41
35
|
|
|
42
36
|
// Command handler.
|
|
43
37
|
const handler = (args) =>
|
|
44
|
-
queue.push(["removeAlpha", (sharp) => sharp.removeAlpha()]);
|
|
38
|
+
args["#queue"].push(["removeAlpha", (sharp) => sharp.removeAlpha()]);
|
|
45
39
|
|
|
46
40
|
// Exports.
|
|
47
|
-
|
|
41
|
+
export default {
|
|
48
42
|
command: "removeAlpha",
|
|
49
43
|
describe: "Remove alpha channel, if any",
|
|
50
44
|
builder,
|
|
@@ -23,12 +23,6 @@
|
|
|
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
|
|
@@ -44,10 +38,10 @@ const builder = (yargs) => {
|
|
|
44
38
|
|
|
45
39
|
// Command handler.
|
|
46
40
|
const handler = (args) =>
|
|
47
|
-
queue.push(["greyscale", (sharp) => sharp.greyscale()]);
|
|
41
|
+
args["#queue"].push(["greyscale", (sharp) => sharp.greyscale()]);
|
|
48
42
|
|
|
49
43
|
// Exports.
|
|
50
|
-
|
|
44
|
+
export default {
|
|
51
45
|
command: "greyscale",
|
|
52
46
|
aliases: "grayscale",
|
|
53
47
|
describe: "Convert to 8-bit greyscale; 256 shades of grey",
|
|
@@ -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,12 +23,8 @@
|
|
|
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 = {
|
|
@@ -55,14 +51,14 @@ const builder = (yargs) => {
|
|
|
55
51
|
|
|
56
52
|
// Command handler.
|
|
57
53
|
const handler = (args) => {
|
|
58
|
-
return queue.push([
|
|
54
|
+
return args["#queue"].push([
|
|
59
55
|
"pipelineColourspace",
|
|
60
56
|
(sharp) => sharp.pipelineColourspace(args.colourspace),
|
|
61
57
|
]);
|
|
62
58
|
};
|
|
63
59
|
|
|
64
60
|
// Exports.
|
|
65
|
-
|
|
61
|
+
export default {
|
|
66
62
|
command: "pipelineColourspace <colourspace>",
|
|
67
63
|
aliases: "pipelineColorspace",
|
|
68
64
|
describe: "Set the pipeline colourspace",
|
|
@@ -23,12 +23,6 @@
|
|
|
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: {
|
|
@@ -49,10 +43,11 @@ const builder = (yargs) => {
|
|
|
49
43
|
};
|
|
50
44
|
|
|
51
45
|
// Command handler.
|
|
52
|
-
const handler = (args) =>
|
|
46
|
+
const handler = (args) =>
|
|
47
|
+
args["#queue"].push(["tint", (sharp) => sharp.tint(args.rgb)]);
|
|
53
48
|
|
|
54
49
|
// Exports.
|
|
55
|
-
|
|
50
|
+
export default {
|
|
56
51
|
command: "tint <rgb>",
|
|
57
52
|
describe:
|
|
58
53
|
"Tint the image using the provided chroma while preserving the image luminance",
|
|
@@ -23,12 +23,8 @@
|
|
|
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 = {
|
|
@@ -52,14 +48,14 @@ const builder = (yargs) => {
|
|
|
52
48
|
|
|
53
49
|
// Command handler.
|
|
54
50
|
const handler = (args) => {
|
|
55
|
-
return queue.push([
|
|
51
|
+
return args["#queue"].push([
|
|
56
52
|
"toColourspace",
|
|
57
53
|
(sharp) => sharp.toColourspace(args.colourspace),
|
|
58
54
|
]);
|
|
59
55
|
};
|
|
60
56
|
|
|
61
57
|
// Exports.
|
|
62
|
-
|
|
58
|
+
export default {
|
|
63
59
|
command: "toColourspace <colourspace>",
|
|
64
60
|
aliases: "toColorspace",
|
|
65
61
|
describe: "Set the output colourspace",
|
|
@@ -23,12 +23,8 @@
|
|
|
23
23
|
|
|
24
24
|
// @see http://sharp.pixelplumbing.com/api-composite#composite
|
|
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
|
// Helpers.
|
|
34
30
|
function getValueAt(arrayLike, index) {
|
|
@@ -70,18 +66,22 @@ const options = {
|
|
|
70
66
|
choices: [3, 4],
|
|
71
67
|
default: 3,
|
|
72
68
|
desc: "Number of channels of the blank overlay to be created",
|
|
69
|
+
nargs: 1,
|
|
73
70
|
},
|
|
74
71
|
"create.height": {
|
|
75
72
|
desc: "Height of the blank overlay to be created",
|
|
73
|
+
nargs: 1,
|
|
76
74
|
type: "number",
|
|
77
75
|
},
|
|
78
76
|
"create.width": {
|
|
79
77
|
desc: "Width of the blank overlay to be created",
|
|
78
|
+
nargs: 1,
|
|
80
79
|
type: "number",
|
|
81
80
|
},
|
|
82
81
|
density: {
|
|
83
82
|
desc: "Number representing the DPI for vector images",
|
|
84
83
|
defaultDescription: 72,
|
|
84
|
+
nargs: 1,
|
|
85
85
|
type: "number",
|
|
86
86
|
},
|
|
87
87
|
gravity: {
|
|
@@ -92,6 +92,7 @@ const options = {
|
|
|
92
92
|
left: {
|
|
93
93
|
desc: "The pixel offset from the left edge",
|
|
94
94
|
implies: "top",
|
|
95
|
+
nargs: 1,
|
|
95
96
|
type: "number",
|
|
96
97
|
},
|
|
97
98
|
premultiplied: {
|
|
@@ -105,6 +106,7 @@ const options = {
|
|
|
105
106
|
top: {
|
|
106
107
|
desc: "The pixel offset from the top edge",
|
|
107
108
|
implies: "left",
|
|
109
|
+
nargs: 1,
|
|
108
110
|
type: "number",
|
|
109
111
|
},
|
|
110
112
|
};
|
|
@@ -180,7 +182,7 @@ const handler = (args) => {
|
|
|
180
182
|
if (args.images) inputs.push(...args.images);
|
|
181
183
|
|
|
182
184
|
// @see http://sharp.pixelplumbing.com/api-composite#composite
|
|
183
|
-
return queue.push([
|
|
185
|
+
return args["#queue"].push([
|
|
184
186
|
"composite",
|
|
185
187
|
(sharp) => {
|
|
186
188
|
return sharp.composite(
|
|
@@ -194,6 +196,7 @@ const handler = (args) => {
|
|
|
194
196
|
ignoreIcc: getValueAt(args.ignoreIcc),
|
|
195
197
|
input,
|
|
196
198
|
left: getValueAt(args.left, idx),
|
|
199
|
+
limitInputChannels: args.limitInputChannels,
|
|
197
200
|
limitInputPixels: args.limitInputPixels,
|
|
198
201
|
pdfBackground: args.pdfBackground,
|
|
199
202
|
premultiplied: getValueAt(args.premultiplied, idx),
|
|
@@ -206,7 +209,7 @@ const handler = (args) => {
|
|
|
206
209
|
};
|
|
207
210
|
|
|
208
211
|
// Exports.
|
|
209
|
-
|
|
212
|
+
export default {
|
|
210
213
|
command: "composite [images..]",
|
|
211
214
|
describe:
|
|
212
215
|
"Composite image(s) over the processed (resized, extracted etc.) image",
|
package/cmd/operations/affine.js
CHANGED
|
@@ -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,15 +23,9 @@
|
|
|
23
23
|
|
|
24
24
|
// @see https://sharp.pixelplumbing.com/api-operation#affine
|
|
25
25
|
|
|
26
|
-
// Strict mode.
|
|
27
|
-
"use strict";
|
|
28
|
-
|
|
29
|
-
// Package modules.
|
|
30
|
-
const pick = require("lodash.pick");
|
|
31
|
-
|
|
32
26
|
// Local modules.
|
|
33
|
-
|
|
34
|
-
|
|
27
|
+
import constants from "../../lib/constants.js";
|
|
28
|
+
import { pick } from "../../lib/utils.js";
|
|
35
29
|
|
|
36
30
|
// Configure.
|
|
37
31
|
const placeholders = {
|
|
@@ -51,21 +45,25 @@ const options = {
|
|
|
51
45
|
idx: {
|
|
52
46
|
defaultDescription: "0",
|
|
53
47
|
desc: "The input horizontal offset",
|
|
48
|
+
nargs: 1,
|
|
54
49
|
type: "number",
|
|
55
50
|
},
|
|
56
51
|
idy: {
|
|
57
52
|
defaultDescription: "0",
|
|
58
53
|
desc: "The input vertical offset",
|
|
54
|
+
nargs: 1,
|
|
59
55
|
type: "number",
|
|
60
56
|
},
|
|
61
57
|
odx: {
|
|
62
58
|
defaultDescription: "0",
|
|
63
59
|
desc: "The output horizontal offset",
|
|
60
|
+
nargs: 1,
|
|
64
61
|
type: "number",
|
|
65
62
|
},
|
|
66
63
|
ody: {
|
|
67
64
|
defaultDescription: "0",
|
|
68
65
|
desc: "The output vertical offset",
|
|
66
|
+
nargs: 1,
|
|
69
67
|
type: "number",
|
|
70
68
|
},
|
|
71
69
|
interpolate: {
|
|
@@ -97,7 +95,7 @@ const builder = (yargs) => {
|
|
|
97
95
|
|
|
98
96
|
// Command handler.
|
|
99
97
|
const handler = (args) => {
|
|
100
|
-
return queue.push([
|
|
98
|
+
return args["#queue"].push([
|
|
101
99
|
"affine",
|
|
102
100
|
(sharp) => {
|
|
103
101
|
const { matrix } = args;
|
|
@@ -110,7 +108,7 @@ const handler = (args) => {
|
|
|
110
108
|
};
|
|
111
109
|
|
|
112
110
|
// Exports.
|
|
113
|
-
|
|
111
|
+
export default {
|
|
114
112
|
command: "affine <matrix..>",
|
|
115
113
|
describe: "Perform an affine transform on an image",
|
|
116
114
|
builder,
|
package/cmd/operations/blur.js
CHANGED
|
@@ -23,12 +23,6 @@
|
|
|
23
23
|
|
|
24
24
|
// @see https://sharp.pixelplumbing.com/api-operation#blur
|
|
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
|
sigma: {
|
|
@@ -42,6 +36,7 @@ const options = {
|
|
|
42
36
|
minAmplitude: {
|
|
43
37
|
defaultDescription: 0.2,
|
|
44
38
|
desc: "A smaller value will generate a larger, more accurate mask",
|
|
39
|
+
nargs: 1,
|
|
45
40
|
type: "number",
|
|
46
41
|
},
|
|
47
42
|
precision: {
|
|
@@ -71,7 +66,7 @@ const builder = (yargs) => {
|
|
|
71
66
|
|
|
72
67
|
// Command handler.
|
|
73
68
|
const handler = (args) => {
|
|
74
|
-
return queue.push([
|
|
69
|
+
return args["#queue"].push([
|
|
75
70
|
"blur",
|
|
76
71
|
(sharp) => {
|
|
77
72
|
if (args.minAmplitude || args.precision) {
|
|
@@ -87,7 +82,7 @@ const handler = (args) => {
|
|
|
87
82
|
};
|
|
88
83
|
|
|
89
84
|
// Exports.
|
|
90
|
-
|
|
85
|
+
export default {
|
|
91
86
|
command: "blur [sigma]",
|
|
92
87
|
describe: "Blur the image",
|
|
93
88
|
builder,
|
|
@@ -23,12 +23,8 @@
|
|
|
23
23
|
|
|
24
24
|
// @see https://sharp.pixelplumbing.com/api-operation#boolean
|
|
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 = {
|
|
@@ -56,14 +52,14 @@ const builder = (yargs) => {
|
|
|
56
52
|
|
|
57
53
|
// Command handler.
|
|
58
54
|
const handler = (args) => {
|
|
59
|
-
return queue.push([
|
|
55
|
+
return args["#queue"].push([
|
|
60
56
|
"boolean",
|
|
61
57
|
(sharp) => sharp.boolean(args.operand, args.operator),
|
|
62
58
|
]);
|
|
63
59
|
};
|
|
64
60
|
|
|
65
61
|
// Exports.
|
|
66
|
-
|
|
62
|
+
export default {
|
|
67
63
|
command: "boolean <operand> <operator>",
|
|
68
64
|
describe: "Perform a bitwise boolean operation with operand image",
|
|
69
65
|
builder,
|
package/cmd/operations/clahe.js
CHANGED
|
@@ -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,12 +23,6 @@
|
|
|
23
23
|
|
|
24
24
|
// @see https://sharp.pixelplumbing.com/api-operation#clahe
|
|
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
|
height: {
|
|
@@ -45,6 +39,7 @@ const options = {
|
|
|
45
39
|
maxSlope: {
|
|
46
40
|
defaultDescription: 3,
|
|
47
41
|
desc: "Maximum value for the slope of the cumulative histogram",
|
|
42
|
+
nargs: 1,
|
|
48
43
|
type: "number",
|
|
49
44
|
},
|
|
50
45
|
};
|
|
@@ -66,7 +61,7 @@ const builder = (yargs) => {
|
|
|
66
61
|
|
|
67
62
|
// Command handler.
|
|
68
63
|
const handler = (args) => {
|
|
69
|
-
return queue.push([
|
|
64
|
+
return args["#queue"].push([
|
|
70
65
|
"clahe",
|
|
71
66
|
(sharp) => {
|
|
72
67
|
return sharp.clahe({
|
|
@@ -79,7 +74,7 @@ const handler = (args) => {
|
|
|
79
74
|
};
|
|
80
75
|
|
|
81
76
|
// Exports.
|
|
82
|
-
|
|
77
|
+
export default {
|
|
83
78
|
command: "clahe <width> <height>",
|
|
84
79
|
describe: "Perform contrast limiting adaptive histogram equalization CLAHE",
|
|
85
80
|
builder,
|