Respect fastShrinkOnLoad option for WebP input #3516

This commit is contained in:
Lovell Fuller
2023-01-17 09:39:23 +00:00
parent 9f79f80a93
commit c150263ef1
3 changed files with 12 additions and 1 deletions

View File

@@ -115,6 +115,14 @@ describe('WebP', function () {
)
);
it('should produce different file size with/out shrink-on-load', async () => {
const [shrunk, resized] = await Promise.all([
sharp(fixtures.inputWebP).resize({ width: 16 }).toBuffer(),
sharp(fixtures.inputWebP).resize({ width: 16, fastShrinkOnLoad: false, kernel: 'nearest' }).toBuffer()
]);
assert.notStrictEqual(shrunk.length, resized.length);
});
it('invalid effort throws', () => {
assert.throws(() => {
sharp().webp({ effort: true });