Ensure animated GIF to WebP conversion retains loop #3394

This commit is contained in:
Lovell Fuller
2025-04-23 15:43:58 +01:00
parent 38b6f44611
commit 701143afb3
5 changed files with 26 additions and 13 deletions

View File

@@ -238,4 +238,15 @@ describe('GIF input', () => {
assert.strictEqual(1, loop);
}
});
it('Animated GIF to animated WebP merges identical frames', async () => {
const webp = await sharp(fixtures.inputGifAnimated, { animated: true })
.webp()
.toBuffer();
const { delay, loop, pages } = await sharp(webp).metadata();
assert.deepStrictEqual([120, 120, 90, 120, 120, 90, 120, 90, 30], delay);
assert.strictEqual(0, loop);
assert.strictEqual(9, pages);
});
});