mirror of
https://github.com/lovell/sharp.git
synced 2025-07-09 18:40:16 +02:00
Allow WebP encoding effort of 0 (#3261)
This commit is contained in:
parent
b10d8f89ca
commit
4662527a17
@ -495,7 +495,7 @@ function webp (options) {
|
||||
if (is.defined(options.smartSubsample)) {
|
||||
this._setBooleanOption('webpSmartSubsample', options.smartSubsample);
|
||||
}
|
||||
const effort = options.effort || options.reductionEffort;
|
||||
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;
|
||||
|
@ -133,6 +133,12 @@ describe('WebP', function () {
|
||||
});
|
||||
});
|
||||
|
||||
it('should set effort to 0', () => {
|
||||
const effort = sharp().webp({ effort: 0 }).options.webpEffort;
|
||||
|
||||
assert.strictEqual(effort, 0);
|
||||
});
|
||||
|
||||
it('invalid loop throws', () => {
|
||||
assert.throws(() => {
|
||||
sharp().webp({ loop: -1 });
|
||||
|
Loading…
x
Reference in New Issue
Block a user