@depup/sharp-cli 5.3.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/CHANGELOG.md +20 -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 +4 -10
- 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 +93 -55
- package/lib/index.js +46 -17
- package/lib/utils.js +50 -0
- package/package.json +24 -33
|
@@ -23,14 +23,8 @@
|
|
|
23
23
|
|
|
24
24
|
// @see https://sharp.pixelplumbing.com/api-operation#convolve
|
|
25
25
|
|
|
26
|
-
// Strict mode.
|
|
27
|
-
"use strict";
|
|
28
|
-
|
|
29
|
-
// Package modules.
|
|
30
|
-
const pick = require("lodash.pick");
|
|
31
|
-
|
|
32
26
|
// Local modules.
|
|
33
|
-
|
|
27
|
+
import { pick } from "../../lib/utils.js";
|
|
34
28
|
|
|
35
29
|
// Configure.
|
|
36
30
|
const positionals = {
|
|
@@ -54,11 +48,13 @@ const options = {
|
|
|
54
48
|
scale: {
|
|
55
49
|
desc: "The scale of the kernel in pixels",
|
|
56
50
|
defaultDescription: "sum",
|
|
51
|
+
nargs: 1,
|
|
57
52
|
type: "number",
|
|
58
53
|
},
|
|
59
54
|
offset: {
|
|
60
55
|
desc: "The offset of the kernel in pixels",
|
|
61
56
|
defaultDescription: "0",
|
|
57
|
+
nargs: 1,
|
|
62
58
|
type: "number",
|
|
63
59
|
},
|
|
64
60
|
};
|
|
@@ -91,7 +87,7 @@ const builder = (yargs) => {
|
|
|
91
87
|
|
|
92
88
|
// Command handler.
|
|
93
89
|
const handler = (args) => {
|
|
94
|
-
return queue.push([
|
|
90
|
+
return args["#queue"].push([
|
|
95
91
|
"convolve",
|
|
96
92
|
(sharp) => {
|
|
97
93
|
return sharp.convolve({
|
|
@@ -103,7 +99,7 @@ const handler = (args) => {
|
|
|
103
99
|
};
|
|
104
100
|
|
|
105
101
|
// Exports.
|
|
106
|
-
|
|
102
|
+
export default {
|
|
107
103
|
command: "convolve <width> <height> <kernel..>",
|
|
108
104
|
describe: "Convolve the image with the specified kernel",
|
|
109
105
|
builder,
|
package/cmd/operations/dilate.js
CHANGED
|
@@ -23,12 +23,6 @@
|
|
|
23
23
|
|
|
24
24
|
// @see https://sharp.pixelplumbing.com/api-operation#dilate
|
|
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
|
width: {
|
|
@@ -52,11 +46,11 @@ const builder = (yargs) => {
|
|
|
52
46
|
|
|
53
47
|
// Command handler.
|
|
54
48
|
const handler = (args) => {
|
|
55
|
-
return queue.push(["dilate", (sharp) => sharp.dilate(args.width)]);
|
|
49
|
+
return args["#queue"].push(["dilate", (sharp) => sharp.dilate(args.width)]);
|
|
56
50
|
};
|
|
57
51
|
|
|
58
52
|
// Exports.
|
|
59
|
-
|
|
53
|
+
export default {
|
|
60
54
|
command: "dilate [width]",
|
|
61
55
|
describe: "Expand foreground objects using the dilate morphological operator",
|
|
62
56
|
builder,
|
package/cmd/operations/erode.js
CHANGED
|
@@ -23,12 +23,6 @@
|
|
|
23
23
|
|
|
24
24
|
// @see https://sharp.pixelplumbing.com/api-operation#erode
|
|
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
|
width: {
|
|
@@ -52,11 +46,11 @@ const builder = (yargs) => {
|
|
|
52
46
|
|
|
53
47
|
// Command handler.
|
|
54
48
|
const handler = (args) => {
|
|
55
|
-
return queue.push(["erode", (sharp) => sharp.erode(args.width)]);
|
|
49
|
+
return args["#queue"].push(["erode", (sharp) => sharp.erode(args.width)]);
|
|
56
50
|
};
|
|
57
51
|
|
|
58
52
|
// Exports.
|
|
59
|
-
|
|
53
|
+
export default {
|
|
60
54
|
command: "erode [width]",
|
|
61
55
|
describe: "Shrink foreground objects using the erode morphological operator",
|
|
62
56
|
builder,
|
|
@@ -23,12 +23,6 @@
|
|
|
23
23
|
|
|
24
24
|
// @see https://sharp.pixelplumbing.com/api-operation#flatten
|
|
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
|
background: {
|
|
@@ -51,7 +45,7 @@ const builder = (yargs) => {
|
|
|
51
45
|
|
|
52
46
|
// Command handler.
|
|
53
47
|
const handler = (args) => {
|
|
54
|
-
return queue.push([
|
|
48
|
+
return args["#queue"].push([
|
|
55
49
|
"flatten",
|
|
56
50
|
(sharp) => {
|
|
57
51
|
return sharp.flatten({ background: args.background });
|
|
@@ -60,7 +54,7 @@ const handler = (args) => {
|
|
|
60
54
|
};
|
|
61
55
|
|
|
62
56
|
// Exports.
|
|
63
|
-
|
|
57
|
+
export default {
|
|
64
58
|
command: "flatten [background]",
|
|
65
59
|
describe: "Merge alpha transparency channel, if any, with a background",
|
|
66
60
|
builder,
|
package/cmd/operations/flip.js
CHANGED
|
@@ -23,12 +23,6 @@
|
|
|
23
23
|
|
|
24
24
|
// @see https://sharp.pixelplumbing.com/api-operation#flip
|
|
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
|
|
@@ -40,10 +34,11 @@ const builder = (yargs) => {
|
|
|
40
34
|
};
|
|
41
35
|
|
|
42
36
|
// Command handler.
|
|
43
|
-
const handler = (args) =>
|
|
37
|
+
const handler = (args) =>
|
|
38
|
+
args["#queue"].push(["flip", (sharp) => sharp.flip()]);
|
|
44
39
|
|
|
45
40
|
// Exports.
|
|
46
|
-
|
|
41
|
+
export default {
|
|
47
42
|
command: "flip",
|
|
48
43
|
describe: "Flip the image about the vertical Y axis",
|
|
49
44
|
builder,
|
package/cmd/operations/flop.js
CHANGED
|
@@ -23,12 +23,6 @@
|
|
|
23
23
|
|
|
24
24
|
// @see https://sharp.pixelplumbing.com/api-operation#flop
|
|
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
|
|
@@ -40,10 +34,11 @@ const builder = (yargs) => {
|
|
|
40
34
|
};
|
|
41
35
|
|
|
42
36
|
// Command handler.
|
|
43
|
-
const handler = (args) =>
|
|
37
|
+
const handler = (args) =>
|
|
38
|
+
args["#queue"].push(["flop", (sharp) => sharp.flop()]);
|
|
44
39
|
|
|
45
40
|
// Exports.
|
|
46
|
-
|
|
41
|
+
export default {
|
|
47
42
|
command: "flop",
|
|
48
43
|
describe: "Flop the image about the horizontal X axis",
|
|
49
44
|
builder,
|
package/cmd/operations/gamma.js
CHANGED
|
@@ -23,12 +23,6 @@
|
|
|
23
23
|
|
|
24
24
|
// @see https://sharp.pixelplumbing.com/api-operation#gamma
|
|
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
|
gamma: {
|
|
@@ -56,7 +50,7 @@ const builder = (yargs) => {
|
|
|
56
50
|
|
|
57
51
|
// Command handler.
|
|
58
52
|
const handler = (args) =>
|
|
59
|
-
queue.push([
|
|
53
|
+
args["#queue"].push([
|
|
60
54
|
"gamma",
|
|
61
55
|
(sharp) => {
|
|
62
56
|
return sharp.gamma(args.gamma, args.gammaOut);
|
|
@@ -64,7 +58,7 @@ const handler = (args) =>
|
|
|
64
58
|
]);
|
|
65
59
|
|
|
66
60
|
// Exports.
|
|
67
|
-
|
|
61
|
+
export default {
|
|
68
62
|
command: "gamma [gamma] [gammaOut]",
|
|
69
63
|
describe:
|
|
70
64
|
"Apply a gamma correction by reducing the encoding (darken) pre-resize then increasing the encoding (brighten) post-resize",
|
package/cmd/operations/linear.js
CHANGED
|
@@ -23,12 +23,6 @@
|
|
|
23
23
|
|
|
24
24
|
// @see https://sharp.pixelplumbing.com/api-operation#linear
|
|
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
|
multiplier: {
|
|
@@ -64,14 +58,14 @@ const builder = (yargs) => {
|
|
|
64
58
|
const handler = (args) => {
|
|
65
59
|
const multiplier =
|
|
66
60
|
args.multiplier.length === 1 ? args.multiplier[0] : args.multiplier;
|
|
67
|
-
return queue.push([
|
|
61
|
+
return args["#queue"].push([
|
|
68
62
|
"linear",
|
|
69
63
|
(sharp) => sharp.linear(multiplier, args.offset),
|
|
70
64
|
]);
|
|
71
65
|
};
|
|
72
66
|
|
|
73
67
|
// Exports.
|
|
74
|
-
|
|
68
|
+
export default {
|
|
75
69
|
command: "linear [multiplier..]",
|
|
76
70
|
describe:
|
|
77
71
|
"Apply the linear formula a × input + b to the image to adjust image levels",
|
package/cmd/operations/median.js
CHANGED
|
@@ -23,12 +23,6 @@
|
|
|
23
23
|
|
|
24
24
|
// @see https://sharp.pixelplumbing.com/api-operation#median
|
|
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
|
size: {
|
|
@@ -52,11 +46,11 @@ const builder = (yargs) => {
|
|
|
52
46
|
|
|
53
47
|
// Command handler.
|
|
54
48
|
const handler = (args) => {
|
|
55
|
-
return queue.push(["median", (sharp) => sharp.median(args.size)]);
|
|
49
|
+
return args["#queue"].push(["median", (sharp) => sharp.median(args.size)]);
|
|
56
50
|
};
|
|
57
51
|
|
|
58
52
|
// Exports.
|
|
59
|
-
|
|
53
|
+
export default {
|
|
60
54
|
command: "median [size]",
|
|
61
55
|
describe: "Apply median filter",
|
|
62
56
|
builder,
|
|
@@ -23,31 +23,29 @@
|
|
|
23
23
|
|
|
24
24
|
// @see http://sharp.pixelplumbing.com/api-operation#modulate
|
|
25
25
|
|
|
26
|
-
// Strict mode.
|
|
27
|
-
"use strict";
|
|
28
|
-
|
|
29
|
-
// Package modules.
|
|
30
|
-
const pick = require("lodash.pick");
|
|
31
|
-
|
|
32
26
|
// Local modules.
|
|
33
|
-
|
|
27
|
+
import { pick } from "../../lib/utils.js";
|
|
34
28
|
|
|
35
29
|
// Configure.
|
|
36
30
|
const options = {
|
|
37
31
|
brightness: {
|
|
38
32
|
desc: "Brightness multiplier",
|
|
33
|
+
nargs: 1,
|
|
39
34
|
type: "number",
|
|
40
35
|
},
|
|
41
36
|
hue: {
|
|
42
37
|
desc: "Degrees for hue rotation",
|
|
38
|
+
nargs: 1,
|
|
43
39
|
type: "number",
|
|
44
40
|
},
|
|
45
41
|
lightness: {
|
|
46
42
|
desc: "Lightness addend",
|
|
43
|
+
nargs: 1,
|
|
47
44
|
type: "number",
|
|
48
45
|
},
|
|
49
46
|
saturation: {
|
|
50
47
|
desc: "Saturation multiplier",
|
|
48
|
+
nargs: 1,
|
|
51
49
|
type: "number",
|
|
52
50
|
},
|
|
53
51
|
};
|
|
@@ -76,10 +74,13 @@ const builder = (yargs) => {
|
|
|
76
74
|
|
|
77
75
|
// Command handler.
|
|
78
76
|
const handler = (args) =>
|
|
79
|
-
queue.push([
|
|
77
|
+
args["#queue"].push([
|
|
78
|
+
"modulate",
|
|
79
|
+
(sharp) => sharp.modulate(pick(args, optionNames)),
|
|
80
|
+
]);
|
|
80
81
|
|
|
81
82
|
// Exports.
|
|
82
|
-
|
|
83
|
+
export default {
|
|
83
84
|
command: "modulate",
|
|
84
85
|
describe:
|
|
85
86
|
"Transforms the image using brightness, saturation, hue rotation, and lightness",
|
package/cmd/operations/negate.js
CHANGED
|
@@ -23,12 +23,6 @@
|
|
|
23
23
|
|
|
24
24
|
// @see https://sharp.pixelplumbing.com/api-operation#negate
|
|
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 options = {
|
|
34
28
|
alpha: {
|
|
@@ -52,10 +46,10 @@ const builder = (yargs) => {
|
|
|
52
46
|
|
|
53
47
|
// Command handler.
|
|
54
48
|
const handler = (args) =>
|
|
55
|
-
queue.push(["negate", (sharp) => sharp.negate(args.alpha)]);
|
|
49
|
+
args["#queue"].push(["negate", (sharp) => sharp.negate(args.alpha)]);
|
|
56
50
|
|
|
57
51
|
// Exports.
|
|
58
|
-
|
|
52
|
+
export default {
|
|
59
53
|
command: "negate",
|
|
60
54
|
describe: 'Produce the "negative" of the image',
|
|
61
55
|
builder,
|
|
@@ -23,24 +23,20 @@
|
|
|
23
23
|
|
|
24
24
|
// @see https://sharp.pixelplumbing.com/api-operation#normalise
|
|
25
25
|
|
|
26
|
-
// Strict mode.
|
|
27
|
-
"use strict";
|
|
28
|
-
|
|
29
|
-
// Package modules.
|
|
30
|
-
const pick = require("lodash.pick");
|
|
31
|
-
|
|
32
26
|
// Local modules.
|
|
33
|
-
|
|
27
|
+
import { pick } from "../../lib/utils.js";
|
|
34
28
|
|
|
35
29
|
const options = {
|
|
36
30
|
lower: {
|
|
37
31
|
default: 1,
|
|
38
32
|
desc: "Percentile below which luminance values will be underexposed",
|
|
33
|
+
nargs: 1,
|
|
39
34
|
type: "number",
|
|
40
35
|
},
|
|
41
36
|
upper: {
|
|
42
37
|
default: 99,
|
|
43
38
|
desc: "Percentile below which luminance values will be overexposed",
|
|
39
|
+
nargs: 1,
|
|
44
40
|
type: "number",
|
|
45
41
|
},
|
|
46
42
|
};
|
|
@@ -60,13 +56,13 @@ const builder = (yargs) => {
|
|
|
60
56
|
|
|
61
57
|
// Command handler.
|
|
62
58
|
const handler = (args) =>
|
|
63
|
-
queue.push([
|
|
59
|
+
args["#queue"].push([
|
|
64
60
|
"normalise",
|
|
65
61
|
(sharp) => sharp.normalise(pick(args, optionNames)),
|
|
66
62
|
]);
|
|
67
63
|
|
|
68
64
|
// Exports.
|
|
69
|
-
|
|
65
|
+
export default {
|
|
70
66
|
command: "normalise",
|
|
71
67
|
aliases: "normalize",
|
|
72
68
|
describe:
|
package/cmd/operations/recomb.js
CHANGED
|
@@ -23,12 +23,6 @@
|
|
|
23
23
|
|
|
24
24
|
// @see https://sharp.pixelplumbing.com/api-operation#recomb
|
|
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 placeholders = {
|
|
34
28
|
matrix: {
|
|
@@ -61,7 +55,7 @@ const builder = (yargs) => {
|
|
|
61
55
|
// Command handler.
|
|
62
56
|
const handler = (args) => {
|
|
63
57
|
const { matrix } = args;
|
|
64
|
-
return queue.push([
|
|
58
|
+
return args["#queue"].push([
|
|
65
59
|
"recomb",
|
|
66
60
|
(sharp) => {
|
|
67
61
|
return sharp.recomb([
|
|
@@ -74,7 +68,7 @@ const handler = (args) => {
|
|
|
74
68
|
};
|
|
75
69
|
|
|
76
70
|
// Exports.
|
|
77
|
-
|
|
71
|
+
export default {
|
|
78
72
|
command: "recomb <matrix..>",
|
|
79
73
|
describe: "Recomb the image with the specified matrix",
|
|
80
74
|
builder,
|
package/cmd/operations/rotate.js
CHANGED
|
@@ -23,12 +23,6 @@
|
|
|
23
23
|
|
|
24
24
|
// @see https://sharp.pixelplumbing.com/api-operation#rotate
|
|
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
|
angle: {
|
|
@@ -65,14 +59,14 @@ const builder = (yargs) => {
|
|
|
65
59
|
|
|
66
60
|
// Command handler.
|
|
67
61
|
const handler = (args) => {
|
|
68
|
-
return queue.push([
|
|
62
|
+
return args["#queue"].push([
|
|
69
63
|
"rotate",
|
|
70
64
|
(sharp) => sharp.rotate(args.angle, { background: args.background }),
|
|
71
65
|
]);
|
|
72
66
|
};
|
|
73
67
|
|
|
74
68
|
// Exports.
|
|
75
|
-
|
|
69
|
+
export default {
|
|
76
70
|
command: "rotate [angle]",
|
|
77
71
|
describe: "Rotate the output image",
|
|
78
72
|
builder,
|
|
@@ -23,14 +23,8 @@
|
|
|
23
23
|
|
|
24
24
|
// @see https://sharp.pixelplumbing.com/api-operation#sharpen
|
|
25
25
|
|
|
26
|
-
// Strict mode.
|
|
27
|
-
"use strict";
|
|
28
|
-
|
|
29
|
-
// Package modules.
|
|
30
|
-
const pick = require("lodash.pick");
|
|
31
|
-
|
|
32
26
|
// Local modules.
|
|
33
|
-
|
|
27
|
+
import { pick } from "../../lib/utils.js";
|
|
34
28
|
|
|
35
29
|
// Configure.
|
|
36
30
|
const positionals = {
|
|
@@ -46,27 +40,32 @@ const options = {
|
|
|
46
40
|
alias: "flat",
|
|
47
41
|
desc: 'The level of sharpening to apply to "flat" areas',
|
|
48
42
|
defaultDescription: 1.0,
|
|
43
|
+
nargs: 1,
|
|
49
44
|
type: "number",
|
|
50
45
|
},
|
|
51
46
|
m2: {
|
|
52
47
|
alias: "jagged",
|
|
53
48
|
desc: 'The level of sharpening to apply to "jagged" areas',
|
|
54
49
|
defaultDescription: 2.0,
|
|
50
|
+
nargs: 1,
|
|
55
51
|
type: "number",
|
|
56
52
|
},
|
|
57
53
|
x1: {
|
|
58
54
|
desc: 'The threshold between "flat" and "jagged" areas',
|
|
59
55
|
defaultDescription: 2.0,
|
|
56
|
+
nargs: 1,
|
|
60
57
|
type: "number",
|
|
61
58
|
},
|
|
62
59
|
y2: {
|
|
63
60
|
desc: "The maximum amount of brightening",
|
|
64
61
|
defaultDescription: 10.0,
|
|
62
|
+
nargs: 1,
|
|
65
63
|
type: "number",
|
|
66
64
|
},
|
|
67
65
|
y3: {
|
|
68
66
|
desc: "The maximum amount of darkening",
|
|
69
67
|
defaultDescription: 20.0,
|
|
68
|
+
nargs: 1,
|
|
70
69
|
type: "number",
|
|
71
70
|
},
|
|
72
71
|
};
|
|
@@ -94,7 +93,7 @@ const handler = (args) => {
|
|
|
94
93
|
...pick(args, optionNames),
|
|
95
94
|
};
|
|
96
95
|
|
|
97
|
-
return queue.push([
|
|
96
|
+
return args["#queue"].push([
|
|
98
97
|
"sharpen",
|
|
99
98
|
(sharp) => {
|
|
100
99
|
if (Object.keys(options).length === 0) {
|
|
@@ -106,7 +105,7 @@ const handler = (args) => {
|
|
|
106
105
|
};
|
|
107
106
|
|
|
108
107
|
// Exports.
|
|
109
|
-
|
|
108
|
+
export default {
|
|
110
109
|
command: "sharpen [sigma]",
|
|
111
110
|
describe: "Sharpen the image",
|
|
112
111
|
builder,
|
|
@@ -23,12 +23,6 @@
|
|
|
23
23
|
|
|
24
24
|
// @see https://sharp.pixelplumbing.com/api-operation#threshold
|
|
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
|
value: {
|
|
@@ -61,7 +55,7 @@ const builder = (yargs) => {
|
|
|
61
55
|
|
|
62
56
|
// Command handler.
|
|
63
57
|
const handler = (args) => {
|
|
64
|
-
return queue.push([
|
|
58
|
+
return args["#queue"].push([
|
|
65
59
|
"threshold",
|
|
66
60
|
(sharp) => {
|
|
67
61
|
return sharp.threshold(args.value, { greyscale: args.greyscale });
|
|
@@ -70,7 +64,7 @@ const handler = (args) => {
|
|
|
70
64
|
};
|
|
71
65
|
|
|
72
66
|
// Exports.
|
|
73
|
-
|
|
67
|
+
export default {
|
|
74
68
|
command: "threshold [value]",
|
|
75
69
|
describe:
|
|
76
70
|
"Any pixel value greater than or equal to the threshold value will be set to 255, otherwise it will be set to 0",
|
|
@@ -23,12 +23,6 @@
|
|
|
23
23
|
|
|
24
24
|
// @see https://sharp.pixelplumbing.com/api-operation#unflatten
|
|
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(["unflatten", (sharp) => sharp.unflatten()]);
|
|
38
|
+
args["#queue"].push(["unflatten", (sharp) => sharp.unflatten()]);
|
|
45
39
|
|
|
46
40
|
// Exports.
|
|
47
|
-
|
|
41
|
+
export default {
|
|
48
42
|
command: "unflatten",
|
|
49
43
|
describe:
|
|
50
44
|
"Ensure the image has an alpha channel with all white pixel values made fully transparent",
|
package/cmd/output.js
CHANGED
|
@@ -23,15 +23,9 @@
|
|
|
23
23
|
|
|
24
24
|
// @see https://sharp.pixelplumbing.com/api-output#tile
|
|
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 positionals = {
|
|
@@ -47,6 +41,7 @@ const options = {
|
|
|
47
41
|
choices: [0, 90, 180, 270],
|
|
48
42
|
defaultDescription: "0",
|
|
49
43
|
desc: "Tile angle of rotation",
|
|
44
|
+
nargs: 1,
|
|
50
45
|
},
|
|
51
46
|
background: {
|
|
52
47
|
defaultDescription: "rgb(255, 255, 255, 1)",
|
|
@@ -85,11 +80,13 @@ const options = {
|
|
|
85
80
|
overlap: {
|
|
86
81
|
desc: "Tile overlap in pixels",
|
|
87
82
|
defaultDescription: "0",
|
|
83
|
+
nargs: 1,
|
|
88
84
|
type: "number",
|
|
89
85
|
},
|
|
90
86
|
skipBlanks: {
|
|
91
87
|
defaultDescription: -1,
|
|
92
88
|
desc: "Threshold to skip tile generation",
|
|
89
|
+
nargs: 1,
|
|
93
90
|
type: "number",
|
|
94
91
|
},
|
|
95
92
|
};
|
|
@@ -113,7 +110,7 @@ const builder = (yargs) => {
|
|
|
113
110
|
|
|
114
111
|
// Command handler.
|
|
115
112
|
const handler = (args) => {
|
|
116
|
-
return queue.push([
|
|
113
|
+
return args["#queue"].push([
|
|
117
114
|
"tile",
|
|
118
115
|
(sharp) => {
|
|
119
116
|
return sharp.tile({
|
|
@@ -125,7 +122,7 @@ const handler = (args) => {
|
|
|
125
122
|
};
|
|
126
123
|
|
|
127
124
|
// Exports.
|
|
128
|
-
|
|
125
|
+
export default {
|
|
129
126
|
command: "tile [size]",
|
|
130
127
|
describe: "Use tile-based deep zoom (image pyramid) output",
|
|
131
128
|
builder,
|
package/cmd/resizing/extend.js
CHANGED
|
@@ -23,15 +23,9 @@
|
|
|
23
23
|
|
|
24
24
|
// @see https://sharp.pixelplumbing.com/api-resize#extend
|
|
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 positionals = {
|
|
@@ -92,7 +86,7 @@ const builder = (yargs) => {
|
|
|
92
86
|
|
|
93
87
|
// Command handler.
|
|
94
88
|
const handler = (args) => {
|
|
95
|
-
return queue.push([
|
|
89
|
+
return args["#queue"].push([
|
|
96
90
|
"extend",
|
|
97
91
|
(sharp) => {
|
|
98
92
|
return sharp.extend({
|
|
@@ -105,7 +99,7 @@ const handler = (args) => {
|
|
|
105
99
|
};
|
|
106
100
|
|
|
107
101
|
// Exports.
|
|
108
|
-
|
|
102
|
+
export default {
|
|
109
103
|
command: "extend <top> <bottom> <left> <right>",
|
|
110
104
|
describe:
|
|
111
105
|
"Extends/pads the edges of the image with the provided background colour",
|