Non-animated GIF output defaults to no-loop #3394

This commit is contained in:
Lovell Fuller
2025-03-21 09:36:25 +00:00
parent 3fd818c4b5
commit 3e41f8b65e
5 changed files with 22 additions and 8 deletions

View File

@@ -224,4 +224,18 @@ describe('GIF input', () => {
const after = await input.gif({ interPaletteMaxError: 100 }).toBuffer();
assert.strict(before.length > after.length);
});
it('non-animated input defaults to no-loop', async () => {
for (const input of [fixtures.inputGif, fixtures.inputPng]) {
const data = await sharp(input)
.resize(8)
.gif({ effort: 1 })
.toBuffer();
const { format, pages, loop } = await sharp(data).metadata();
assert.strictEqual('gif', format);
assert.strictEqual(1, pages);
assert.strictEqual(1, loop);
}
});
});