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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 1 deletions

View File

@ -327,7 +327,6 @@ struct PipelineBaton {
ensureAlpha(-1.0),
colourspaceInput(VIPS_INTERPRETATION_LAST),
colourspace(VIPS_INTERPRETATION_LAST),
delay{-1},
loop(-1),
tileSize(256),
tileOverlap(0),

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 }))