diff --git a/docs/changelog.md b/docs/changelog.md index f46483d4..0e87a3ed 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -12,6 +12,8 @@ Requires libvips v8.13.0 * Add WebP `minSize` and `mixed` options for greater control over animation frames. +* Remove previously-deprecated WebP `reductionEffort` and HEIF `speed` options. Use `effort` to control these. + * Use combined bounding box of alpha and non-alpha channels for `trim` operation. [#2166](https://github.com/lovell/sharp/issues/2166) diff --git a/lib/output.js b/lib/output.js index df09965d..3ba4a99e 100644 --- a/lib/output.js +++ b/lib/output.js @@ -500,12 +500,11 @@ function webp (options) { if (is.defined(options.smartSubsample)) { this._setBooleanOption('webpSmartSubsample', options.smartSubsample); } - const effort = is.defined(options.effort) ? options.effort : options.reductionEffort; - if (is.defined(effort)) { - if (is.integer(effort) && is.inRange(effort, 0, 6)) { - this.options.webpEffort = effort; + if (is.defined(options.effort)) { + if (is.integer(options.effort) && is.inRange(options.effort, 0, 6)) { + this.options.webpEffort = options.effort; } else { - throw is.invalidParameterError('effort', 'integer between 0 and 6', effort); + throw is.invalidParameterError('effort', 'integer between 0 and 6', options.effort); } } if (is.defined(options.minSize)) { @@ -884,12 +883,6 @@ function heif (options) { } else { throw is.invalidParameterError('effort', 'integer between 0 and 9', options.effort); } - } else if (is.defined(options.speed)) { - if (is.integer(options.speed) && is.inRange(options.speed, 0, 9)) { - this.options.heifEffort = 9 - options.speed; - } else { - throw is.invalidParameterError('speed', 'integer between 0 and 9', options.speed); - } } if (is.defined(options.chromaSubsampling)) { if (is.string(options.chromaSubsampling) && is.inArray(options.chromaSubsampling, ['4:2:0', '4:4:4'])) { diff --git a/test/unit/heif.js b/test/unit/heif.js index 36a73e3a..b8568247 100644 --- a/test/unit/heif.js +++ b/test/unit/heif.js @@ -52,7 +52,7 @@ describe('HEIF', () => { }); it('valid effort does not throw an error', () => { assert.doesNotThrow(() => { - sharp().heif({ speed: 6 }); + sharp().heif({ effort: 6 }); }); }); it('out of range effort should throw an error', () => { @@ -65,21 +65,6 @@ describe('HEIF', () => { sharp().heif({ effort: 'fail' }); }); }); - it('valid speed does not throw an error', () => { - assert.doesNotThrow(() => { - sharp().heif({ speed: 6 }); - }); - }); - it('out of range speed should throw an error', () => { - assert.throws(() => { - sharp().heif({ speed: 10 }); - }); - }); - it('invalid speed should throw an error', () => { - assert.throws(() => { - sharp().heif({ speed: 'fail' }); - }); - }); it('invalid chromaSubsampling should throw an error', () => { assert.throws(() => { sharp().heif({ chromaSubsampling: 'fail' }); diff --git a/test/unit/webp.js b/test/unit/webp.js index a297bcc0..ab7fc4c4 100644 --- a/test/unit/webp.js +++ b/test/unit/webp.js @@ -121,12 +121,6 @@ describe('WebP', function () { }); }); - it('invalid reductionEffort (deprecated) throws', () => { - assert.throws(() => { - sharp().webp({ reductionEffort: true }); - }); - }); - it('out of range effort throws', () => { assert.throws(() => { sharp().webp({ effort: -1 });