Skip to content

Commit

Permalink
Ensure delays of the origin image is preserved (#3062)
Browse files Browse the repository at this point in the history
By not initializing the delay vector, since we assume it's empty by default.

See: #3061.
  • Loading branch information
kleisauke committed Jan 28, 2022
1 parent 68823a5 commit 7aa3402
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 0 additions & 1 deletion src/pipeline.h
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
9 changes: 9 additions & 0 deletions test/unit/webp.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 }))
Expand Down

0 comments on commit 7aa3402

Please sign in to comment.