Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it possible to composite GIFS over a base GIF? #3135

Closed
EtDu opened this issue Mar 14, 2022 · 2 comments
Closed

Is it possible to composite GIFS over a base GIF? #3135

EtDu opened this issue Mar 14, 2022 · 2 comments
Labels

Comments

@EtDu
Copy link

EtDu commented Mar 14, 2022

Question about an existing feature

What are you trying to achieve?

Overlaying GIFS over a base GIF / merging multiple GIFs together.

tester

When you searched for similar issues, what did you find that might be related?

I've searched, but did not find an equivalent issue

Please provide a minimal, standalone code sample, without other dependencies, that demonstrates this question

const compositeGif = someGif.gif
const finalImage = await sharp(compositeGif, { animated: true }).composite([
 {
          input: gifBuffer1,
          tile: true
        },
{
          input: gifBuffer2,
          tile: true
        }
], {}).gif()

It appears that sharp is currently only capable of overlaying static images (PNG, JPEG) over a base GIF. Is there something I'm missing here?

@lovell
Copy link
Owner

lovell commented Mar 14, 2022

To use all frames of an animated image as the overlay, try something like:

          input: gifBuffer1,
+         animated: true,
          tile: true

This was missing from the docs, which I've just corrected in ac883c5

To stitch together animated images, so the frames of one follow another, please see future possible enhancement #1580

@EtDu
Copy link
Author

EtDu commented Mar 15, 2022

Thanks a ton, works like a charm!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants