@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.
Files changed (50) hide show
  1. package/.github/workflows/ci.yml +30 -0
  2. package/.prettierignore +2 -0
  3. package/.prettierrc +1 -0
  4. package/CHANGELOG.md +40 -8
  5. package/README.md +6 -9
  6. package/bin/cli.js +5 -5
  7. package/changes.json +5 -17
  8. package/cmd/channel-manipulation/bandbool.js +24 -19
  9. package/cmd/channel-manipulation/ensure-alpha.js +27 -22
  10. package/cmd/channel-manipulation/extract-channel.js +23 -19
  11. package/cmd/channel-manipulation/join-channel.js +19 -20
  12. package/cmd/channel-manipulation/remove-alpha.js +12 -15
  13. package/cmd/colour-manipulation/greyscale.js +16 -16
  14. package/cmd/colour-manipulation/pipeline-colourspace.js +26 -22
  15. package/cmd/colour-manipulation/tint.js +17 -19
  16. package/cmd/colour-manipulation/tocolourspace.js +22 -21
  17. package/cmd/compositing/composite.js +133 -102
  18. package/cmd/operations/affine.js +57 -51
  19. package/cmd/operations/blur.js +44 -41
  20. package/cmd/operations/boolean.js +22 -21
  21. package/cmd/operations/clahe.js +37 -37
  22. package/cmd/operations/convolve.js +52 -48
  23. package/cmd/operations/dilate.js +58 -0
  24. package/cmd/operations/erode.js +58 -0
  25. package/cmd/operations/flatten.js +23 -24
  26. package/cmd/operations/flip.js +12 -15
  27. package/cmd/operations/flop.js +12 -15
  28. package/cmd/operations/gamma.js +26 -25
  29. package/cmd/operations/linear.js +30 -29
  30. package/cmd/operations/median.js +18 -22
  31. package/cmd/operations/modulate.js +42 -31
  32. package/cmd/operations/negate.js +17 -20
  33. package/cmd/operations/normalise.js +28 -25
  34. package/cmd/operations/recomb.js +34 -32
  35. package/cmd/operations/rotate.js +31 -29
  36. package/cmd/operations/sharpen.js +49 -45
  37. package/cmd/operations/threshold.js +29 -29
  38. package/cmd/operations/unflatten.js +14 -16
  39. package/cmd/output.js +61 -56
  40. package/cmd/resizing/extend.js +55 -49
  41. package/cmd/resizing/extract.js +32 -33
  42. package/cmd/resizing/resize.js +79 -56
  43. package/cmd/resizing/trim.js +59 -36
  44. package/{lib/queue.js → eslint.config.mjs} +21 -17
  45. package/lib/cli.js +637 -383
  46. package/lib/constants.js +24 -18
  47. package/lib/convert.js +106 -73
  48. package/lib/index.js +56 -23
  49. package/lib/utils.js +50 -0
  50. package/package.json +27 -37
@@ -23,41 +23,42 @@
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
- const constants = require('../../lib/constants')
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
32
  choices: constants.COLOURSPACE,
37
- default: 'srgb',
38
- desc: 'The output colourspace'
39
- }
40
- }
33
+ default: "srgb",
34
+ desc: "The output colourspace",
35
+ },
36
+ };
41
37
 
42
38
  // Command builder.
43
39
  const builder = (yargs) => {
44
40
  return yargs
45
41
  .strict()
46
- .example('$0 toColourspace rgb16', 'Output 16 bits per pixel RGB')
47
- .epilog('For more information on available options, please visit https://sharp.pixelplumbing.com/api-colour#tocolourspace')
48
- .positional('colourspace', positionals.colourspace)
49
- }
42
+ .example("$0 toColourspace rgb16", "Output 16 bits per pixel RGB")
43
+ .epilog(
44
+ "For more information on available options, please visit https://sharp.pixelplumbing.com/api-colour#tocolourspace",
45
+ )
46
+ .positional("colourspace", positionals.colourspace);
47
+ };
50
48
 
51
49
  // Command handler.
52
50
  const handler = (args) => {
53
- return queue.push(['toColourspace', (sharp) => sharp.toColourspace(args.colourspace)])
54
- }
51
+ return args["#queue"].push([
52
+ "toColourspace",
53
+ (sharp) => sharp.toColourspace(args.colourspace),
54
+ ]);
55
+ };
55
56
 
56
57
  // Exports.
57
- module.exports = {
58
- command: 'toColourspace <colourspace>',
59
- aliases: 'toColorspace',
60
- describe: 'Set the output colourspace',
58
+ export default {
59
+ command: "toColourspace <colourspace>",
60
+ aliases: "toColorspace",
61
+ describe: "Set the output colourspace",
61
62
  builder,
62
- handler
63
- }
63
+ handler,
64
+ };
@@ -23,165 +23,196 @@
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
- const constants = require('../../lib/constants')
31
- const queue = require('../../lib/queue')
27
+ import constants from "../../lib/constants.js";
32
28
 
33
29
  // Helpers.
34
- function getValueAt (arrayLike, index) {
30
+ function getValueAt(arrayLike, index) {
35
31
  if (Array.isArray(arrayLike)) {
36
- return arrayLike[Math.min(index, arrayLike.length - 1)]
32
+ return arrayLike[Math.min(index, arrayLike.length - 1)];
37
33
  }
38
- return arrayLike
34
+ return arrayLike;
39
35
  }
40
36
 
41
- function hasOwnProperty (obj, prop) {
42
- return obj != null && Object.prototype.hasOwnProperty.call(obj, prop)
37
+ function hasOwnProperty(obj, prop) {
38
+ return obj != null && Object.prototype.hasOwnProperty.call(obj, prop);
43
39
  }
44
40
 
45
41
  // Configure.
46
42
  const positionals = {
47
43
  images: {
48
- desc: 'Path to an image file',
44
+ desc: "Path to an image file",
49
45
  normalize: true,
50
- type: 'string'
51
- }
52
- }
46
+ type: "string",
47
+ },
48
+ };
53
49
 
54
50
  const options = {
55
51
  blend: {
56
52
  choices: constants.BLEND,
57
- defaultDescription: 'over',
58
- desc: 'How to blend this image with the image below'
53
+ defaultDescription: "over",
54
+ desc: "How to blend this image with the image below",
59
55
  },
60
56
  create: {
61
- desc: 'Describes a blank overlay to be created',
57
+ desc: "Describes a blank overlay to be created",
62
58
  hidden: true,
63
- type: 'boolean'
59
+ type: "boolean",
64
60
  },
65
- 'create.background': {
66
- desc: 'Background of the blank overlay to be created, parsed by the color module',
67
- type: 'string'
61
+ "create.background": {
62
+ desc: "Background of the blank overlay to be created, parsed by the color module",
63
+ type: "string",
68
64
  },
69
- 'create.channels': {
65
+ "create.channels": {
70
66
  choices: [3, 4],
71
67
  default: 3,
72
- desc: 'Number of channels of the blank overlay to be created'
68
+ desc: "Number of channels of the blank overlay to be created",
69
+ nargs: 1,
73
70
  },
74
- 'create.height': {
75
- desc: 'Height of the blank overlay to be created',
76
- type: 'number'
71
+ "create.height": {
72
+ desc: "Height of the blank overlay to be created",
73
+ nargs: 1,
74
+ type: "number",
77
75
  },
78
- 'create.width': {
79
- desc: 'Width of the blank overlay to be created',
80
- type: 'number'
76
+ "create.width": {
77
+ desc: "Width of the blank overlay to be created",
78
+ nargs: 1,
79
+ type: "number",
81
80
  },
82
81
  density: {
83
- desc: 'Number representing the DPI for vector images',
82
+ desc: "Number representing the DPI for vector images",
84
83
  defaultDescription: 72,
85
- type: 'number'
84
+ nargs: 1,
85
+ type: "number",
86
86
  },
87
87
  gravity: {
88
88
  choices: constants.GRAVITY,
89
- defaultDescription: 'centre',
90
- desc: 'Gravity at which to place the overlay'
89
+ defaultDescription: "centre",
90
+ desc: "Gravity at which to place the overlay",
91
91
  },
92
92
  left: {
93
- desc: 'The pixel offset from the left edge',
94
- implies: 'top',
95
- type: 'number'
93
+ desc: "The pixel offset from the left edge",
94
+ implies: "top",
95
+ nargs: 1,
96
+ type: "number",
96
97
  },
97
98
  premultiplied: {
98
- desc: 'Avoid premultiplying the image',
99
- type: 'boolean'
99
+ desc: "Avoid premultiplying the image",
100
+ type: "boolean",
100
101
  },
101
102
  tile: {
102
- desc: 'Repeat the overlay image across the entire image with the given gravity',
103
- type: 'boolean'
103
+ desc: "Repeat the overlay image across the entire image with the given gravity",
104
+ type: "boolean",
104
105
  },
105
106
  top: {
106
- desc: 'The pixel offset from the top edge',
107
- implies: 'left',
108
- type: 'number'
109
- }
110
- }
107
+ desc: "The pixel offset from the top edge",
108
+ implies: "left",
109
+ nargs: 1,
110
+ type: "number",
111
+ },
112
+ };
111
113
 
112
114
  // Command builder.
113
115
  const builder = (yargs) => {
114
- const optionNames = Object.keys(options)
116
+ const optionNames = Object.keys(options);
115
117
  return yargs
116
118
  .strict()
117
- .example('$0 composite ./input.png --gravity southeast', 'The output will be the input composited with ./input.png with SE gravity')
118
- .example('$0 composite ./layer1.png --gravity northwest ./layer2.png --gravity southeast', 'The output will be the input composited with ./layer1.png with NW gravity and ./layer2.png with SE gravity')
119
- .example('$0 composite ./overlay.png --tile --blend saturate', 'The output will be the input composited with ./overlay.png saturated over the entire image')
120
- .epilog('For more information on available options, please visit http://sharp.pixelplumbing.com/api-composite#composite')
121
- .positional('images', positionals.images)
122
- .check(argv => {
123
- if ((!argv.images || argv.images.length === 0) && !hasOwnProperty(argv.create, 'width')) {
124
- throw new Error('Expected at least one of images positional or create option')
119
+ .example(
120
+ "$0 composite ./input.png --gravity southeast",
121
+ "The output will be the input composited with ./input.png with SE gravity",
122
+ )
123
+ .example(
124
+ "$0 composite ./layer1.png --gravity northwest ./layer2.png --gravity southeast",
125
+ "The output will be the input composited with ./layer1.png with NW gravity and ./layer2.png with SE gravity",
126
+ )
127
+ .example(
128
+ "$0 composite ./overlay.png --tile --blend saturate",
129
+ "The output will be the input composited with ./overlay.png saturated over the entire image",
130
+ )
131
+ .epilog(
132
+ "For more information on available options, please visit http://sharp.pixelplumbing.com/api-composite#composite",
133
+ )
134
+ .positional("images", positionals.images)
135
+ .check((argv) => {
136
+ if (
137
+ (!argv.images || argv.images.length === 0) &&
138
+ !hasOwnProperty(argv.create, "width")
139
+ ) {
140
+ throw new Error(
141
+ "Expected at least one of images positional or create option",
142
+ );
125
143
  }
126
- return true
144
+ return true;
127
145
  })
128
146
  .options(options)
129
- .group(optionNames, 'Command Options')
130
- }
147
+ .group(optionNames, "Command Options");
148
+ };
131
149
 
132
150
  // Command handler.
133
151
  const handler = (args) => {
134
- if ((hasOwnProperty(args.create, 'width') && !hasOwnProperty(args.create, 'height')) ||
135
- (hasOwnProperty(args.create, 'height') && !hasOwnProperty(args.create, 'width'))) {
136
- throw new Error('Expected both of create.width and create.height options')
152
+ if (
153
+ (hasOwnProperty(args.create, "width") &&
154
+ !hasOwnProperty(args.create, "height")) ||
155
+ (hasOwnProperty(args.create, "height") &&
156
+ !hasOwnProperty(args.create, "width"))
157
+ ) {
158
+ throw new Error("Expected both of create.width and create.height options");
137
159
  }
138
160
 
139
- const inputs = []
140
- if (hasOwnProperty(args.create, 'width')) {
141
- const { channels, background, width, height } = args.create
142
- const length = Math.max(width.length ?? 0, height.length ?? 0)
143
- if (length > 0) { // Width or height (or both) is an array.
144
- inputs.push(...Array.from({ length }, (_, idx) => idx).map(idx => ({
145
- create: {
146
- width: getValueAt(width, idx),
147
- height: getValueAt(height, idx),
148
- channels: getValueAt(channels, idx),
149
- background: getValueAt(background, idx)
150
- }
151
- })))
152
- } else { // Both width and height are numbers.
153
- inputs.push({ create: args.create })
161
+ const inputs = [];
162
+ if (hasOwnProperty(args.create, "width")) {
163
+ const { channels, background, width, height } = args.create;
164
+ const length = Math.max(width.length ?? 0, height.length ?? 0);
165
+ if (length > 0) {
166
+ // Width or height (or both) is an array.
167
+ inputs.push(
168
+ ...Array.from({ length }, (_, idx) => idx).map((idx) => ({
169
+ create: {
170
+ width: getValueAt(width, idx),
171
+ height: getValueAt(height, idx),
172
+ channels: getValueAt(channels, idx),
173
+ background: getValueAt(background, idx),
174
+ },
175
+ })),
176
+ );
177
+ } else {
178
+ // Both width and height are numbers.
179
+ inputs.push({ create: args.create });
154
180
  }
155
181
  }
156
- if (args.images) inputs.push(...args.images)
182
+ if (args.images) inputs.push(...args.images);
157
183
 
158
184
  // @see http://sharp.pixelplumbing.com/api-composite#composite
159
- return queue.push(['composite', (sharp) => {
160
- return sharp.composite(
161
- inputs.map((input, idx) => ({
162
- animated: args.animated,
163
- autoOrient: args.autoOrient,
164
- blend: getValueAt(args.blend, idx),
165
- density: getValueAt(args.density, idx),
166
- failOn: args.failOn,
167
- gravity: getValueAt(args.gravity, idx),
168
- ignoreIcc: getValueAt(args.ignoreIcc),
169
- input,
170
- left: getValueAt(args.left, idx),
171
- limitInputPixels: args.limitInputPixels,
172
- pdfBackground: args.pdfBackground,
173
- premultiplied: getValueAt(args.premultiplied, idx),
174
- tile: getValueAt(args.tile, idx),
175
- top: getValueAt(args.top, idx)
176
- }))
177
- )
178
- }])
179
- }
185
+ return args["#queue"].push([
186
+ "composite",
187
+ (sharp) => {
188
+ return sharp.composite(
189
+ inputs.map((input, idx) => ({
190
+ animated: args.animated,
191
+ autoOrient: args.autoOrient,
192
+ blend: getValueAt(args.blend, idx),
193
+ density: getValueAt(args.density, idx),
194
+ failOn: args.failOn,
195
+ gravity: getValueAt(args.gravity, idx),
196
+ ignoreIcc: getValueAt(args.ignoreIcc),
197
+ input,
198
+ left: getValueAt(args.left, idx),
199
+ limitInputChannels: args.limitInputChannels,
200
+ limitInputPixels: args.limitInputPixels,
201
+ pdfBackground: args.pdfBackground,
202
+ premultiplied: getValueAt(args.premultiplied, idx),
203
+ tile: getValueAt(args.tile, idx),
204
+ top: getValueAt(args.top, idx),
205
+ })),
206
+ );
207
+ },
208
+ ]);
209
+ };
180
210
 
181
211
  // Exports.
182
- module.exports = {
183
- command: 'composite [images..]',
184
- describe: 'Composite image(s) over the processed (resized, extracted etc.) image',
212
+ export default {
213
+ command: "composite [images..]",
214
+ describe:
215
+ "Composite image(s) over the processed (resized, extracted etc.) image",
185
216
  builder,
186
- handler
187
- }
217
+ handler,
218
+ };
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * The MIT License (MIT)
3
3
  *
4
- * Copyright (c) 2022 Mark van Seventer
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,88 +23,94 @@
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
- const constants = require('../../lib/constants')
34
- const queue = require('../../lib/queue')
27
+ import constants from "../../lib/constants.js";
28
+ import { pick } from "../../lib/utils.js";
35
29
 
36
30
  // Configure.
37
31
  const placeholders = {
38
32
  matrix: {
39
- desc: 'Affine transformation matrix',
33
+ desc: "Affine transformation matrix",
40
34
  nargs: 2 * 2,
41
- type: 'number'
42
- }
43
- }
35
+ type: "number",
36
+ },
37
+ };
44
38
 
45
39
  const options = {
46
40
  background: {
47
- defaultDescription: '#000000',
48
- desc: 'String parsed by the color module to extract values for red, green, blue and alpha',
49
- type: 'string'
41
+ defaultDescription: "#000000",
42
+ desc: "String parsed by the color module to extract values for red, green, blue and alpha",
43
+ type: "string",
50
44
  },
51
45
  idx: {
52
- defaultDescription: '0',
53
- desc: 'The input horizontal offset',
54
- type: 'number'
46
+ defaultDescription: "0",
47
+ desc: "The input horizontal offset",
48
+ nargs: 1,
49
+ type: "number",
55
50
  },
56
51
  idy: {
57
- defaultDescription: '0',
58
- desc: 'The input vertical offset',
59
- type: 'number'
52
+ defaultDescription: "0",
53
+ desc: "The input vertical offset",
54
+ nargs: 1,
55
+ type: "number",
60
56
  },
61
57
  odx: {
62
- defaultDescription: '0',
63
- desc: 'The output horizontal offset',
64
- type: 'number'
58
+ defaultDescription: "0",
59
+ desc: "The output horizontal offset",
60
+ nargs: 1,
61
+ type: "number",
65
62
  },
66
63
  ody: {
67
- defaultDescription: '0',
68
- desc: 'The output vertical offset',
69
- type: 'number'
64
+ defaultDescription: "0",
65
+ desc: "The output vertical offset",
66
+ nargs: 1,
67
+ type: "number",
70
68
  },
71
69
  interpolate: {
72
70
  choices: constants.INTERPOLATORS,
73
- defaultDescription: 'bicubic',
74
- desc: 'The input horizontal offset'
75
- }
76
- }
77
- const optionNames = Object.keys(options)
71
+ defaultDescription: "bicubic",
72
+ desc: "The input horizontal offset",
73
+ },
74
+ };
75
+ const optionNames = Object.keys(options);
78
76
 
79
77
  // Command builder.
80
78
  const builder = (yargs) => {
81
79
  return yargs
82
80
  .strict()
83
- .example('$0 affine 1 0.3 0.1 0.7 --background white --interpolate nohalo')
84
- .epilog('For more information on available options, please visit https://sharp.dimens.io/api-operation#affine')
85
- .check(argv => {
81
+ .example("$0 affine 1 0.3 0.1 0.7 --background white --interpolate nohalo")
82
+ .epilog(
83
+ "For more information on available options, please visit https://sharp.pixelplumbing.com/api-operation#affine",
84
+ )
85
+ .check((argv) => {
86
86
  if (!(Array.isArray(argv.matrix) && argv.matrix.length === 4)) {
87
- throw new Error('Expected matrix positional to have 4 values')
87
+ throw new Error("Expected matrix positional to have 4 values");
88
88
  }
89
- return true
89
+ return true;
90
90
  })
91
- .positional('matrix', placeholders.matrix)
91
+ .positional("matrix", placeholders.matrix)
92
92
  .options(options)
93
- .group(optionNames, 'Command Options')
94
- }
93
+ .group(optionNames, "Command Options");
94
+ };
95
95
 
96
96
  // Command handler.
97
97
  const handler = (args) => {
98
- return queue.push(['affine', (sharp) => {
99
- const { matrix } = args
100
- return sharp.affine([matrix.slice(0, 2), matrix.slice(2, 4)], pick(args, optionNames))
101
- }])
102
- }
98
+ return args["#queue"].push([
99
+ "affine",
100
+ (sharp) => {
101
+ const { matrix } = args;
102
+ return sharp.affine(
103
+ [matrix.slice(0, 2), matrix.slice(2, 4)],
104
+ pick(args, optionNames),
105
+ );
106
+ },
107
+ ]);
108
+ };
103
109
 
104
110
  // Exports.
105
- module.exports = {
106
- command: 'affine <matrix..>',
107
- describe: 'Perform an affine transform on an image',
111
+ export default {
112
+ command: "affine <matrix..>",
113
+ describe: "Perform an affine transform on an image",
108
114
  builder,
109
- handler
110
- }
115
+ handler,
116
+ };
@@ -23,65 +23,68 @@
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: {
35
- desc: 'The sigma of the Gaussian mask',
36
- defaultDescription: '1 + radius / 2',
37
- type: 'number'
38
- }
39
- }
29
+ desc: "The sigma of the Gaussian mask",
30
+ defaultDescription: "1 + radius / 2",
31
+ type: "number",
32
+ },
33
+ };
40
34
 
41
35
  const options = {
42
36
  minAmplitude: {
43
37
  defaultDescription: 0.2,
44
- desc: 'A smaller value will generate a larger, more accurate mask',
45
- type: 'number'
38
+ desc: "A smaller value will generate a larger, more accurate mask",
39
+ nargs: 1,
40
+ type: "number",
46
41
  },
47
42
  precision: {
48
- choices: ['approximate', 'float', 'integer'],
49
- defaultDescription: 'integer',
50
- desc: 'How accurate the operation should be'
51
- }
52
- }
43
+ choices: ["approximate", "float", "integer"],
44
+ defaultDescription: "integer",
45
+ desc: "How accurate the operation should be",
46
+ },
47
+ };
53
48
 
54
49
  // Command builder.
55
50
  const builder = (yargs) => {
56
- const optionNames = Object.keys(options)
51
+ const optionNames = Object.keys(options);
57
52
  return yargs
58
53
  .strict()
59
- .example('$0 blur', 'The output will be a fast 3x3 box blurred image')
60
- .example('$0 blur 5', 'The output will be a slower but more accurate Gaussian blurred image')
61
- .epilog('For more information on available options, please visit https://sharp.pixelplumbing.com/api-operation#blur')
62
- .positional('sigma', positionals.sigma)
54
+ .example("$0 blur", "The output will be a fast 3x3 box blurred image")
55
+ .example(
56
+ "$0 blur 5",
57
+ "The output will be a slower but more accurate Gaussian blurred image",
58
+ )
59
+ .epilog(
60
+ "For more information on available options, please visit https://sharp.pixelplumbing.com/api-operation#blur",
61
+ )
62
+ .positional("sigma", positionals.sigma)
63
63
  .options(options)
64
- .group(optionNames, 'Command Options')
65
- }
64
+ .group(optionNames, "Command Options");
65
+ };
66
66
 
67
67
  // Command handler.
68
68
  const handler = (args) => {
69
- return queue.push(['blur', (sharp) => {
70
- if (args.minAmplitude || args.precision) {
71
- return sharp.blur({
72
- minAmplitude: args.minAmplitude,
73
- precision: args.precision,
74
- sigma: args.sigma
75
- })
76
- }
77
- return sharp.blur(args.sigma)
78
- }])
79
- }
69
+ return args["#queue"].push([
70
+ "blur",
71
+ (sharp) => {
72
+ if (args.minAmplitude || args.precision) {
73
+ return sharp.blur({
74
+ minAmplitude: args.minAmplitude,
75
+ precision: args.precision,
76
+ sigma: args.sigma,
77
+ });
78
+ }
79
+ return sharp.blur(args.sigma);
80
+ },
81
+ ]);
82
+ };
80
83
 
81
84
  // Exports.
82
- module.exports = {
83
- command: 'blur [sigma]',
84
- describe: 'Blur the image',
85
+ export default {
86
+ command: "blur [sigma]",
87
+ describe: "Blur the image",
85
88
  builder,
86
- handler
87
- }
89
+ handler,
90
+ };