mirror of
https://github.com/lovell/sharp.git
synced 2025-07-09 18:40:16 +02:00
Remove previously-deprecated reductionEffort and speed options
This commit is contained in:
parent
b46ab510da
commit
76c4c51e2a
@ -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)
|
||||
|
||||
|
@ -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'])) {
|
||||
|
@ -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' });
|
||||
|
@ -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 });
|
||||
|
Loading…
x
Reference in New Issue
Block a user