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

the ability to convert Gif to Webp animated? #317

Open
EnderPicture opened this issue Jan 31, 2022 · 5 comments
Open

the ability to convert Gif to Webp animated? #317

EnderPicture opened this issue Jan 31, 2022 · 5 comments

Comments

@EnderPicture
Copy link

Hi,

I see that it is possible for Sharp to convert Gif to animated Webp files in their doc. Is it possible in image tools? currently, the conversion works but only to a static image.

Thanks!

@JonasKruckenberg
Copy link
Owner

Your link seems to just go to their homepage and I couldn't find the specific option you mentioned.

Maybe you can provide a quick reproduction with a gif that would be converted into an animated webp normally but doesn't get converted when using imagetools so I can can check it out!

@millette
Copy link

millette commented Feb 22, 2022

I think he's referring to options.pages.

number of pages to extract for multi-page input (GIF, WebP, AVIF, TIFF, PDF), use -1 for all pages.

@EnderPicture
Copy link
Author

Sorry for the delay, I was referring to this section

// Convert an animated GIF to an animated WebP
await sharp('in.gif', { animated: true }).toFile('out.webp');

@TomBor
Copy link

TomBor commented Mar 21, 2022

From the constructor page of Sharp website, there are 2 references to animated file in the options

  • options.pages number number of pages to extract for multi-page input (GIF, WebP, AVIF, TIFF, PDF), use -1 for all pages. (optional, default 1)
  • options.animated boolean Set to true to read all frames/pages of an animated image (equivalent of setting pages to -1). (optional, default false)

Would be great to have an option for webp animated or not in imagetools.

@Amerlander
Copy link

Any plans to implements this?

I guess line 6 in util.ts has to be extended to receive the option to enable animations:

return sharp(path, { animated: true })

return sharp(path)

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

No branches or pull requests

5 participants