sharp icon indicating copy to clipboard operation
sharp copied to clipboard

Overlay image repeats vertically in animated GIF

Open EjDadivas opened this issue 1 year ago • 1 comments

Possible bug

When using the composite method with tile: true to add an overlay to an animated GIF, the overlay image repeats vertically across the GIF, creating a scrolling effect.

thumbFile

  const overlay = await sharp('assets/images/sample.png')
  .resize(imgMaxWidth)
  .toBuffer()



sharp(inputGif, { animated: true })
    .composite([{ input: overlay, tile: true, gravity: 'center' }])
    .toFormat("gif")
    .gif({ loop: 0, force: true })
    .toFile(outputGif)
    .catch(console.error);

EjDadivas avatar Feb 14 '24 08:02 EjDadivas

You'll need to ensure the image to overlay is the same dimensions (or an exact multiple thereof).

lovell avatar Feb 14 '24 10:02 lovell

I hope this information helped. Please feel free to re-open with more details if further assistance is required.

lovell avatar Apr 11 '24 07:04 lovell