Javascript 使用 HTML5 画布生成动画 GIF

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10486084/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-24 01:33:45  来源:igfitidea点击:

Generate animated GIF with HTML5 canvas

javascripthtmlcanvashtml5-canvas

提问by brillout

Are they any library to do so?

他们有任何图书馆可以这样做吗?

AFAIK dataToURL('image/gif') isn't supported by any browser

AFAIK dataToURL('image/gif') 不受任何浏览器支持

回答by leemes

Canvas can't generate (animated) GIFs. You need to use a JavaScript library to do so.

Canvas 无法生成(动画)GIF。您需要使用 JavaScript 库来执行此操作。

There is jsgif, a JS library to generate animated GIFs: http://github.com/antimatter15/jsgif

有 jsgif,一个用于生成动画 GIF 的 JS 库:http://github.com/antimatter15/jsgif

This blog post explains the usage: http://antimatter15.com/wp/2010/07/javascript-to-animated-gif/

这篇博文解释了用法:http: //antimatter15.com/wp/2010/07/javascript-to-animated-gif/

回答by brillout

omggif is a JavaScript implementation of a GIF 89a encoder.

omggif 是 GIF 89a 编码器的 JavaScript 实现。

https://github.com/deanm/omggif

https://github.com/deanm/omggif

回答by SMUsamaShah

https://github.com/spite/ccapture.js/looks like an easier and better alternative to capture to gif or video.

https://github.com/spite/ccapture.js/看起来像捕获到 gif 或视频的更简单、更好的替代方法。