mirror of
https://github.com/lovell/sharp.git
synced 2025-07-09 10:30:15 +02:00
Reduce sharpen op max sigma from 10000 to 10 #3521
This commit is contained in:
parent
ef849fd639
commit
081debd055
@ -158,7 +158,7 @@ See [libvips sharpen](https://www.libvips.org/API/current/libvips-convolution.ht
|
||||
| Param | Type | Default | Description |
|
||||
| --- | --- | --- | --- |
|
||||
| [options] | <code>Object</code> \| <code>number</code> | | if present, is an Object with attributes |
|
||||
| [options.sigma] | <code>number</code> | | the sigma of the Gaussian mask, where `sigma = 1 + radius / 2`, between 0.000001 and 10000 |
|
||||
| [options.sigma] | <code>number</code> | | the sigma of the Gaussian mask, where `sigma = 1 + radius / 2`, between 0.000001 and 10 |
|
||||
| [options.m1] | <code>number</code> | <code>1.0</code> | the level of sharpening to apply to "flat" areas, between 0 and 1000000 |
|
||||
| [options.m2] | <code>number</code> | <code>2.0</code> | the level of sharpening to apply to "jagged" areas, between 0 and 1000000 |
|
||||
| [options.x1] | <code>number</code> | <code>2.0</code> | threshold between "flat" and "jagged", between 0 and 1000000 |
|
||||
|
@ -23,6 +23,9 @@ Requires libvips v8.14.0
|
||||
* Prebuilt binaries: prevent use of glib slice allocator, improves QEMU support.
|
||||
[#3448](https://github.com/lovell/sharp/issues/3448)
|
||||
|
||||
* Reduce sharpen `sigma` maximum from 10000 to 10.
|
||||
[#3521](https://github.com/lovell/sharp/issues/3521)
|
||||
|
||||
## v0.31 - *eagle*
|
||||
|
||||
Requires libvips v8.13.3
|
||||
|
@ -232,7 +232,7 @@ function affine (matrix, options) {
|
||||
* .toBuffer();
|
||||
*
|
||||
* @param {Object|number} [options] - if present, is an Object with attributes
|
||||
* @param {number} [options.sigma] - the sigma of the Gaussian mask, where `sigma = 1 + radius / 2`, between 0.000001 and 10000
|
||||
* @param {number} [options.sigma] - the sigma of the Gaussian mask, where `sigma = 1 + radius / 2`, between 0.000001 and 10
|
||||
* @param {number} [options.m1=1.0] - the level of sharpening to apply to "flat" areas, between 0 and 1000000
|
||||
* @param {number} [options.m2=2.0] - the level of sharpening to apply to "jagged" areas, between 0 and 1000000
|
||||
* @param {number} [options.x1=2.0] - threshold between "flat" and "jagged", between 0 and 1000000
|
||||
@ -270,10 +270,10 @@ function sharpen (options, flat, jagged) {
|
||||
}
|
||||
}
|
||||
} else if (is.plainObject(options)) {
|
||||
if (is.number(options.sigma) && is.inRange(options.sigma, 0.000001, 10000)) {
|
||||
if (is.number(options.sigma) && is.inRange(options.sigma, 0.000001, 10)) {
|
||||
this.options.sharpenSigma = options.sigma;
|
||||
} else {
|
||||
throw is.invalidParameterError('options.sigma', 'number between 0.000001 and 10000', options.sigma);
|
||||
throw is.invalidParameterError('options.sigma', 'number between 0.000001 and 10', options.sigma);
|
||||
}
|
||||
if (is.defined(options.m1)) {
|
||||
if (is.number(options.m1) && is.inRange(options.m1, 0, 1000000)) {
|
||||
|
@ -110,7 +110,7 @@ describe('Sharpen', function () {
|
||||
|
||||
it('invalid options.sigma', () => assert.throws(
|
||||
() => sharp().sharpen({ sigma: -1 }),
|
||||
/Expected number between 0\.000001 and 10000 for options\.sigma but received -1 of type number/
|
||||
/Expected number between 0\.000001 and 10 for options\.sigma but received -1 of type number/
|
||||
));
|
||||
|
||||
it('invalid options.m1', () => assert.throws(
|
||||
|
Loading…
x
Reference in New Issue
Block a user