Ensure delays of the origin image is preserved (#3062)

By not initializing the delay vector, since we assume it's empty by default.

See: #3061.
This commit is contained in:
Kleis Auke Wolthuizen
2022-01-28 12:50:31 +01:00
committed by GitHub
parent 68823a5edb
commit 7aa340232e
2 changed files with 9 additions and 1 deletions

View File

@@ -183,6 +183,15 @@ describe('WebP', function () {
assert.deepStrictEqual(updated.delay, expectedDelay);
});
it('should preserve delay between frames', async () => {
const updated = await sharp(fixtures.inputWebPAnimated, { pages: -1 })
.webp()
.toBuffer()
.then(data => sharp(data, { pages: -1 }).metadata());
assert.deepStrictEqual(updated.delay, [120, 120, 90, 120, 120, 90, 120, 90, 30]);
});
it('should work with streams when only animated is set', function (done) {
fs.createReadStream(fixtures.inputWebPAnimated)
.pipe(sharp({ animated: true }))