@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.
Files changed (48) hide show
  1. package/.prettierignore +2 -0
  2. package/.prettierrc +1 -0
  3. package/CHANGELOG.md +20 -8
  4. package/README.md +5 -5
  5. package/bin/cli.js +3 -3
  6. package/changes.json +5 -5
  7. package/cmd/channel-manipulation/bandbool.js +22 -16
  8. package/cmd/channel-manipulation/ensure-alpha.js +25 -17
  9. package/cmd/channel-manipulation/extract-channel.js +24 -16
  10. package/cmd/channel-manipulation/join-channel.js +17 -15
  11. package/cmd/channel-manipulation/remove-alpha.js +13 -10
  12. package/cmd/colour-manipulation/greyscale.js +17 -11
  13. package/cmd/colour-manipulation/pipeline-colourspace.js +26 -18
  14. package/cmd/colour-manipulation/tint.js +17 -14
  15. package/cmd/colour-manipulation/tocolourspace.js +23 -18
  16. package/cmd/compositing/composite.js +127 -99
  17. package/cmd/operations/affine.js +53 -45
  18. package/cmd/operations/blur.js +44 -36
  19. package/cmd/operations/boolean.js +23 -18
  20. package/cmd/operations/clahe.js +36 -31
  21. package/cmd/operations/convolve.js +51 -43
  22. package/cmd/operations/dilate.js +64 -0
  23. package/cmd/operations/erode.js +64 -0
  24. package/cmd/operations/flatten.js +24 -19
  25. package/cmd/operations/flip.js +12 -10
  26. package/cmd/operations/flop.js +12 -10
  27. package/cmd/operations/gamma.js +27 -20
  28. package/cmd/operations/linear.js +31 -24
  29. package/cmd/operations/median.js +19 -17
  30. package/cmd/operations/modulate.js +36 -26
  31. package/cmd/operations/negate.js +18 -15
  32. package/cmd/operations/normalise.js +27 -20
  33. package/cmd/operations/recomb.js +35 -27
  34. package/cmd/operations/rotate.js +32 -24
  35. package/cmd/operations/sharpen.js +45 -40
  36. package/cmd/operations/threshold.js +30 -24
  37. package/cmd/operations/unflatten.js +15 -11
  38. package/cmd/output.js +59 -51
  39. package/cmd/resizing/extend.js +56 -44
  40. package/cmd/resizing/extract.js +33 -28
  41. package/cmd/resizing/resize.js +80 -51
  42. package/cmd/resizing/trim.js +50 -31
  43. package/lib/cli.js +480 -366
  44. package/lib/constants.js +23 -15
  45. package/lib/convert.js +47 -52
  46. package/lib/index.js +23 -19
  47. package/lib/queue.js +8 -7
  48. package/package.json +12 -13
@@ -24,59 +24,64 @@
24
24
  // @see https://sharp.pixelplumbing.com/api-operation#clahe
25
25
 
26
26
  // Strict mode.
27
- 'use strict'
27
+ "use strict";
28
28
 
29
29
  // Local modules.
30
- const queue = require('../../lib/queue')
30
+ const queue = require("../../lib/queue");
31
31
 
32
32
  // Configure.
33
33
  const positionals = {
34
34
  height: {
35
- desc: 'Height of the region',
36
- type: 'number'
35
+ desc: "Height of the region",
36
+ type: "number",
37
37
  },
38
38
  width: {
39
- desc: 'Width of the region',
40
- type: 'number'
41
- }
42
- }
39
+ desc: "Width of the region",
40
+ type: "number",
41
+ },
42
+ };
43
43
 
44
44
  const options = {
45
45
  maxSlope: {
46
46
  defaultDescription: 3,
47
- desc: 'Maximum value for the slope of the cumulative histogram',
48
- type: 'number'
49
- }
50
- }
47
+ desc: "Maximum value for the slope of the cumulative histogram",
48
+ type: "number",
49
+ },
50
+ };
51
51
 
52
52
  // Command builder.
53
53
  const builder = (yargs) => {
54
- const optionNames = Object.keys(options)
54
+ const optionNames = Object.keys(options);
55
55
  return yargs
56
56
  .strict()
57
- .example('$0 clahe 3 3')
58
- .epilog('For more information on available options, please visit https://sharp.pixelplumbing.com/api-operation#clahe')
59
- .positional('height', positionals.height)
60
- .positional('width', positionals.width)
57
+ .example("$0 clahe 3 3")
58
+ .epilog(
59
+ "For more information on available options, please visit https://sharp.pixelplumbing.com/api-operation#clahe",
60
+ )
61
+ .positional("height", positionals.height)
62
+ .positional("width", positionals.width)
61
63
  .options(options)
62
- .group(optionNames, 'Command Options')
63
- }
64
+ .group(optionNames, "Command Options");
65
+ };
64
66
 
65
67
  // Command handler.
66
68
  const handler = (args) => {
67
- return queue.push(['clahe', (sharp) => {
68
- return sharp.clahe({
69
- width: args.width,
70
- height: args.height,
71
- maxSlope: args.maxSlope
72
- })
73
- }])
74
- }
69
+ return queue.push([
70
+ "clahe",
71
+ (sharp) => {
72
+ return sharp.clahe({
73
+ width: args.width,
74
+ height: args.height,
75
+ maxSlope: args.maxSlope,
76
+ });
77
+ },
78
+ ]);
79
+ };
75
80
 
76
81
  // Exports.
77
82
  module.exports = {
78
- command: 'clahe <width> <height>',
79
- describe: 'Perform contrast limiting adaptive histogram equalization CLAHE',
83
+ command: "clahe <width> <height>",
84
+ describe: "Perform contrast limiting adaptive histogram equalization CLAHE",
80
85
  builder,
81
- handler
82
- }
86
+ handler,
87
+ };
@@ -24,80 +24,88 @@
24
24
  // @see https://sharp.pixelplumbing.com/api-operation#convolve
25
25
 
26
26
  // Strict mode.
27
- 'use strict'
27
+ "use strict";
28
28
 
29
29
  // Package modules.
30
- const pick = require('lodash.pick')
30
+ const pick = require("lodash.pick");
31
31
 
32
32
  // Local modules.
33
- const queue = require('../../lib/queue')
33
+ const queue = require("../../lib/queue");
34
34
 
35
35
  // Configure.
36
36
  const positionals = {
37
37
  height: {
38
- desc: 'Height of the kernel in pixels',
39
- type: 'number'
38
+ desc: "Height of the kernel in pixels",
39
+ type: "number",
40
40
  },
41
41
  kernel: {
42
- desc: 'Array of length width × height containing the kernel values',
42
+ desc: "Array of length width × height containing the kernel values",
43
43
  defaultDescription: '"-1 0 1 -2 0 2 -1 0 1"',
44
- type: 'number'
44
+ type: "number",
45
45
  },
46
46
  width: {
47
- desc: 'Width of the kernel in pixels',
48
- type: 'number'
49
- }
50
- }
51
- const positionalNames = Object.keys(positionals)
47
+ desc: "Width of the kernel in pixels",
48
+ type: "number",
49
+ },
50
+ };
51
+ const positionalNames = Object.keys(positionals);
52
52
 
53
53
  const options = {
54
54
  scale: {
55
- desc: 'The scale of the kernel in pixels',
56
- defaultDescription: 'sum',
57
- type: 'number'
55
+ desc: "The scale of the kernel in pixels",
56
+ defaultDescription: "sum",
57
+ type: "number",
58
58
  },
59
59
  offset: {
60
- desc: 'The offset of the kernel in pixels',
61
- defaultDescription: '0',
62
- type: 'number'
63
- }
64
- }
65
- const optionNames = Object.keys(options)
60
+ desc: "The offset of the kernel in pixels",
61
+ defaultDescription: "0",
62
+ type: "number",
63
+ },
64
+ };
65
+ const optionNames = Object.keys(options);
66
66
 
67
67
  // Command builder.
68
68
  const builder = (yargs) => {
69
69
  return yargs
70
70
  .strict()
71
- .example('$0 convolve 3 3 "-1 0 1 -2 0 2 -1 0 1"', 'The output will be the convolution of the input image with the horizontal Sobel operator')
72
- .epilog('For more information on available options, please visit https://sharp.pixelplumbing.com/api-operation#convolve')
73
- .check(argv => {
74
- const length = argv.width * argv.height
71
+ .example(
72
+ '$0 convolve 3 3 "-1 0 1 -2 0 2 -1 0 1"',
73
+ "The output will be the convolution of the input image with the horizontal Sobel operator",
74
+ )
75
+ .epilog(
76
+ "For more information on available options, please visit https://sharp.pixelplumbing.com/api-operation#convolve",
77
+ )
78
+ .check((argv) => {
79
+ const length = argv.width * argv.height;
75
80
  if (!(Array.isArray(argv.kernel) && argv.kernel.length === length)) {
76
- throw new Error(`Expected kernel positional to have ${length} values`)
81
+ throw new Error(`Expected kernel positional to have ${length} values`);
77
82
  }
78
- return true
83
+ return true;
79
84
  })
80
85
  .options(options)
81
- .positional('kernel', positionals.kernel)
82
- .positional('height', positionals.height)
83
- .positional('width', positionals.width)
84
- .group(optionNames, 'Command Options')
85
- }
86
+ .positional("kernel", positionals.kernel)
87
+ .positional("height", positionals.height)
88
+ .positional("width", positionals.width)
89
+ .group(optionNames, "Command Options");
90
+ };
86
91
 
87
92
  // Command handler.
88
93
  const handler = (args) => {
89
- return queue.push(['convolve', (sharp) => {
90
- return sharp.convolve({
91
- ...pick(args, positionalNames),
92
- ...pick(args, optionNames)
93
- })
94
- }])
95
- }
94
+ return queue.push([
95
+ "convolve",
96
+ (sharp) => {
97
+ return sharp.convolve({
98
+ ...pick(args, positionalNames),
99
+ ...pick(args, optionNames),
100
+ });
101
+ },
102
+ ]);
103
+ };
96
104
 
97
105
  // Exports.
98
106
  module.exports = {
99
- command: 'convolve <width> <height> <kernel..>',
100
- describe: 'Convolve the image with the specified kernel',
107
+ command: "convolve <width> <height> <kernel..>",
108
+ describe: "Convolve the image with the specified kernel",
101
109
  builder,
102
- handler
103
- }
110
+ handler,
111
+ };
@@ -0,0 +1,64 @@
1
+ /*!
2
+ * The MIT License (MIT)
3
+ *
4
+ * Copyright (c) 2019 Mark van Seventer
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
7
+ * this software and associated documentation files (the "Software"), to deal in
8
+ * the Software without restriction, including without limitation the rights to
9
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
10
+ * the Software, and to permit persons to whom the Software is furnished to do so,
11
+ * subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in all
14
+ * copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
18
+ * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
19
+ * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
20
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
+ */
23
+
24
+ // @see https://sharp.pixelplumbing.com/api-operation#dilate
25
+
26
+ // Strict mode.
27
+ "use strict";
28
+
29
+ // Local modules.
30
+ const queue = require("../../lib/queue");
31
+
32
+ // Configure.
33
+ const positionals = {
34
+ width: {
35
+ desc: "Dilation width in pixels",
36
+ defaultDescription: 1,
37
+ type: "number",
38
+ },
39
+ };
40
+
41
+ // Command builder.
42
+ const builder = (yargs) => {
43
+ return yargs
44
+ .strict()
45
+ .example("$0 dilate")
46
+ .example("$0 dilate 3")
47
+ .epilog(
48
+ "For more information on available options, please visit https://sharp.pixelplumbing.com/api-operation#dilate",
49
+ )
50
+ .positional("width", positionals.width);
51
+ };
52
+
53
+ // Command handler.
54
+ const handler = (args) => {
55
+ return queue.push(["dilate", (sharp) => sharp.dilate(args.width)]);
56
+ };
57
+
58
+ // Exports.
59
+ module.exports = {
60
+ command: "dilate [width]",
61
+ describe: "Expand foreground objects using the dilate morphological operator",
62
+ builder,
63
+ handler,
64
+ };
@@ -0,0 +1,64 @@
1
+ /*!
2
+ * The MIT License (MIT)
3
+ *
4
+ * Copyright (c) 2019 Mark van Seventer
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
7
+ * this software and associated documentation files (the "Software"), to deal in
8
+ * the Software without restriction, including without limitation the rights to
9
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
10
+ * the Software, and to permit persons to whom the Software is furnished to do so,
11
+ * subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in all
14
+ * copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
18
+ * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
19
+ * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
20
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
+ */
23
+
24
+ // @see https://sharp.pixelplumbing.com/api-operation#erode
25
+
26
+ // Strict mode.
27
+ "use strict";
28
+
29
+ // Local modules.
30
+ const queue = require("../../lib/queue");
31
+
32
+ // Configure.
33
+ const positionals = {
34
+ width: {
35
+ desc: "Erosion width in pixels",
36
+ defaultDescription: 1,
37
+ type: "number",
38
+ },
39
+ };
40
+
41
+ // Command builder.
42
+ const builder = (yargs) => {
43
+ return yargs
44
+ .strict()
45
+ .example("$0 erode")
46
+ .example("$0 erode 3")
47
+ .epilog(
48
+ "For more information on available options, please visit https://sharp.pixelplumbing.com/api-operation#erode",
49
+ )
50
+ .positional("width", positionals.width);
51
+ };
52
+
53
+ // Command handler.
54
+ const handler = (args) => {
55
+ return queue.push(["erode", (sharp) => sharp.erode(args.width)]);
56
+ };
57
+
58
+ // Exports.
59
+ module.exports = {
60
+ command: "erode [width]",
61
+ describe: "Shrink foreground objects using the erode morphological operator",
62
+ builder,
63
+ handler,
64
+ };
@@ -21,43 +21,48 @@
21
21
  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
22
  */
23
23
 
24
- // @see https://sharp.dimens.io/api-operation#flatten
24
+ // @see https://sharp.pixelplumbing.com/api-operation#flatten
25
25
 
26
26
  // Strict mode.
27
- 'use strict'
27
+ "use strict";
28
28
 
29
29
  // Local modules.
30
- const queue = require('../../lib/queue')
30
+ const queue = require("../../lib/queue");
31
31
 
32
32
  // Configure.
33
33
  const positionals = {
34
34
  background: {
35
- defaultDescription: 'rgb(0, 0, 0)',
36
- desc: 'Background colour, parsed by the color module',
37
- type: 'string'
38
- }
39
- }
35
+ defaultDescription: "rgb(0, 0, 0)",
36
+ desc: "Background colour, parsed by the color module",
37
+ type: "string",
38
+ },
39
+ };
40
40
 
41
41
  // Command builder.
42
42
  const builder = (yargs) => {
43
43
  return yargs
44
44
  .strict()
45
45
  .example('$0 flatten "#F0A703"')
46
- .epilog('For more information on available options, please visit https://sharp.dimens.io/api-operation#flatten')
47
- .positional('background', positionals.background)
48
- }
46
+ .epilog(
47
+ "For more information on available options, please visit https://sharp.pixelplumbing.com/api-operation#flatten",
48
+ )
49
+ .positional("background", positionals.background);
50
+ };
49
51
 
50
52
  // Command handler.
51
53
  const handler = (args) => {
52
- return queue.push(['flatten', (sharp) => {
53
- return sharp.flatten({ background: args.background })
54
- }])
55
- }
54
+ return queue.push([
55
+ "flatten",
56
+ (sharp) => {
57
+ return sharp.flatten({ background: args.background });
58
+ },
59
+ ]);
60
+ };
56
61
 
57
62
  // Exports.
58
63
  module.exports = {
59
- command: 'flatten [background]',
60
- describe: 'Merge alpha transparency channel, if any, with a background',
64
+ command: "flatten [background]",
65
+ describe: "Merge alpha transparency channel, if any, with a background",
61
66
  builder,
62
- handler
63
- }
67
+ handler,
68
+ };
@@ -24,26 +24,28 @@
24
24
  // @see https://sharp.pixelplumbing.com/api-operation#flip
25
25
 
26
26
  // Strict mode.
27
- 'use strict'
27
+ "use strict";
28
28
 
29
29
  // Local modules.
30
- const queue = require('../../lib/queue')
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
- .epilog('For more information on available options, please visit https://sharp.pixelplumbing.com/api-operation#flip')
37
- .example('$0 flip')
38
- }
36
+ .epilog(
37
+ "For more information on available options, please visit https://sharp.pixelplumbing.com/api-operation#flip",
38
+ )
39
+ .example("$0 flip");
40
+ };
39
41
 
40
42
  // Command handler.
41
- const handler = (args) => queue.push(['flip', (sharp) => sharp.flip()])
43
+ const handler = (args) => queue.push(["flip", (sharp) => sharp.flip()]);
42
44
 
43
45
  // Exports.
44
46
  module.exports = {
45
- command: 'flip',
46
- describe: 'Flip the image about the vertical Y axis',
47
+ command: "flip",
48
+ describe: "Flip the image about the vertical Y axis",
47
49
  builder,
48
- handler
49
- }
50
+ handler,
51
+ };
@@ -24,26 +24,28 @@
24
24
  // @see https://sharp.pixelplumbing.com/api-operation#flop
25
25
 
26
26
  // Strict mode.
27
- 'use strict'
27
+ "use strict";
28
28
 
29
29
  // Local modules.
30
- const queue = require('../../lib/queue')
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
- .epilog('For more information on available options, please visit https://sharp.pixelplumbing.com/api-operation#flop')
37
- .example('$0 flop')
38
- }
36
+ .epilog(
37
+ "For more information on available options, please visit https://sharp.pixelplumbing.com/api-operation#flop",
38
+ )
39
+ .example("$0 flop");
40
+ };
39
41
 
40
42
  // Command handler.
41
- const handler = (args) => queue.push(['flop', (sharp) => sharp.flop()])
43
+ const handler = (args) => queue.push(["flop", (sharp) => sharp.flop()]);
42
44
 
43
45
  // Exports.
44
46
  module.exports = {
45
- command: 'flop',
46
- describe: 'Flop the image about the horizontal X axis',
47
+ command: "flop",
48
+ describe: "Flop the image about the horizontal X axis",
47
49
  builder,
48
- handler
49
- }
50
+ handler,
51
+ };
@@ -24,43 +24,50 @@
24
24
  // @see https://sharp.pixelplumbing.com/api-operation#gamma
25
25
 
26
26
  // Strict mode.
27
- 'use strict'
27
+ "use strict";
28
28
 
29
29
  // Local modules.
30
- const queue = require('../../lib/queue')
30
+ const queue = require("../../lib/queue");
31
31
 
32
32
  // Configure.
33
33
  const positionals = {
34
34
  gamma: {
35
- desc: 'The gamma factor',
35
+ desc: "The gamma factor",
36
36
  defaultDescription: 2.2,
37
- type: 'number'
37
+ type: "number",
38
38
  },
39
39
  gammaOut: {
40
- desc: 'The gamma factor used for scaling',
41
- defaultDescription: '<gamma>',
42
- type: 'number'
43
- }
44
- }
40
+ desc: "The gamma factor used for scaling",
41
+ defaultDescription: "<gamma>",
42
+ type: "number",
43
+ },
44
+ };
45
45
 
46
46
  // Command builder.
47
47
  const builder = (yargs) => {
48
48
  return yargs
49
49
  .strict()
50
- .epilog('For more information on available options, please visit https://sharp.pixelplumbing.com/api-operation#gamma')
51
- .positional('gamma', positionals.gamma)
52
- .positional('gammaOut', positionals.gammaOut)
53
- }
50
+ .epilog(
51
+ "For more information on available options, please visit https://sharp.pixelplumbing.com/api-operation#gamma",
52
+ )
53
+ .positional("gamma", positionals.gamma)
54
+ .positional("gammaOut", positionals.gammaOut);
55
+ };
54
56
 
55
57
  // Command handler.
56
- const handler = (args) => queue.push(['gamma', (sharp) => {
57
- return sharp.gamma(args.gamma, args.gammaOut)
58
- }])
58
+ const handler = (args) =>
59
+ queue.push([
60
+ "gamma",
61
+ (sharp) => {
62
+ return sharp.gamma(args.gamma, args.gammaOut);
63
+ },
64
+ ]);
59
65
 
60
66
  // Exports.
61
67
  module.exports = {
62
- command: 'gamma [gamma] [gammaOut]',
63
- describe: 'Apply a gamma correction by reducing the encoding (darken) pre-resize then increasing the encoding (brighten) post-resize',
68
+ command: "gamma [gamma] [gammaOut]",
69
+ describe:
70
+ "Apply a gamma correction by reducing the encoding (darken) pre-resize then increasing the encoding (brighten) post-resize",
64
71
  builder,
65
- handler
66
- }
72
+ handler,
73
+ };
@@ -24,50 +24,57 @@
24
24
  // @see https://sharp.pixelplumbing.com/api-operation#linear
25
25
 
26
26
  // Strict mode.
27
- 'use strict'
27
+ "use strict";
28
28
 
29
29
  // Local modules.
30
- const queue = require('../../lib/queue')
30
+ const queue = require("../../lib/queue");
31
31
 
32
32
  // Configure.
33
33
  const positionals = {
34
34
  multiplier: {
35
- desc: 'Multiplier',
35
+ desc: "Multiplier",
36
36
  default: 1.0,
37
- type: 'number'
38
- }
39
- }
37
+ type: "number",
38
+ },
39
+ };
40
40
 
41
41
  const options = {
42
42
  offset: {
43
- desc: 'Offset',
44
- type: 'array'
45
- }
46
- }
43
+ desc: "Offset",
44
+ type: "array",
45
+ },
46
+ };
47
47
 
48
48
  // Command builder.
49
49
  const builder = (yargs) => {
50
- const optionNames = Object.keys(options)
50
+ const optionNames = Object.keys(options);
51
51
  return yargs
52
52
  .strict()
53
- .example('$0 linear 0.5 --offset 2')
54
- .example('$0 linear 0.25 0.5 0.75 --offset 150 100 50')
55
- .epilog('For more information on available options, please visit https://sharp.pixelplumbing.com/api-operation#linear')
56
- .positional('multiplier', positionals.multiplier)
53
+ .example("$0 linear 0.5 --offset 2")
54
+ .example("$0 linear 0.25 0.5 0.75 --offset 150 100 50")
55
+ .epilog(
56
+ "For more information on available options, please visit https://sharp.pixelplumbing.com/api-operation#linear",
57
+ )
58
+ .positional("multiplier", positionals.multiplier)
57
59
  .options(options)
58
- .group(optionNames, 'Command Options')
59
- }
60
+ .group(optionNames, "Command Options");
61
+ };
60
62
 
61
63
  // Command handler.
62
64
  const handler = (args) => {
63
- const multiplier = args.multiplier.length === 1 ? args.multiplier[0] : args.multiplier
64
- return queue.push(['linear', (sharp) => sharp.linear(multiplier, args.offset)])
65
- }
65
+ const multiplier =
66
+ args.multiplier.length === 1 ? args.multiplier[0] : args.multiplier;
67
+ return queue.push([
68
+ "linear",
69
+ (sharp) => sharp.linear(multiplier, args.offset),
70
+ ]);
71
+ };
66
72
 
67
73
  // Exports.
68
74
  module.exports = {
69
- command: 'linear [multiplier..]',
70
- describe: 'Apply the linear formula a × input + b to the image to adjust image levels',
75
+ command: "linear [multiplier..]",
76
+ describe:
77
+ "Apply the linear formula a × input + b to the image to adjust image levels",
71
78
  builder,
72
- handler
73
- }
79
+ handler,
80
+ };