sharp
sharp copied to clipboard
Overlay image repeats vertically in animated GIF
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.
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);
You'll need to ensure the image to overlay is the same dimensions (or an exact multiple thereof).
I hope this information helped. Please feel free to re-open with more details if further assistance is required.