Skip to content

Commit

Permalink
Bump sharp dependency.
Browse files Browse the repository at this point in the history
  • Loading branch information
vseventer committed Sep 13, 2024
1 parent c12d5e1 commit 525d1e4
Show file tree
Hide file tree
Showing 5 changed files with 178 additions and 199 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 5.1.0 (September 12, 2024)
* Added `--minAmplitude` and `--precision` blur options.
* Updated `sharp` dependency.

## 5.0.0 (July 14, 2024)
* Added `hbitdepth`, `miniswhite` options to `heif` command.
* Added `lineArt` option to `trim` command.
Expand Down
27 changes: 26 additions & 1 deletion cmd/operations/blur.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,19 +38,44 @@ const positionals = {
}
}

const options = {
minAmplitude: {
defaultDescription: 0.2,
desc: 'A smaller value will generate a larger, more accurate mask',
type: 'number'
},
precision: {
choices: ['approximate', 'float', 'integer'],
defaultDescription: 'integer',
desc: 'How accurate the operation should be'
}
}

// Command builder.
const builder = (yargs) => {
const optionNames = Object.keys(options)
return yargs
.strict()
.example('$0 blur', 'The output will be a fast 3x3 box blurred image')
.example('$0 blur 5', 'The output will be a slower but more accurate Gaussian blurred image')
.epilog('For more information on available options, please visit https://sharp.pixelplumbing.com/api-operation#blur')
.positional('sigma', positionals.sigma)
.options(options)
.group(optionNames, 'Command Options')
}

// Command handler.
const handler = (args) => {
return queue.push(['blur', (sharp) => sharp.blur(args.sigma)])
return queue.push(['blur', (sharp) => {
if (args.minAmplitude || args.precision) {
return sharp.blur({
minAmplitude: args.minAmplitude,
precision: args.precision,
sigma: args.sigma
})
}
return sharp.blur(args.sigma)
}])
}

// Exports.
Expand Down
Loading

0 comments on commit 525d1e4

Please sign in to comment.