javascript - 如何下载使用 GIF.js 创建的 GIF?
问题描述
我有一个GIF.js GIF,如果我.render()
在新窗口中调用 opens,但我找不到有关如何拥有一个允许客户端下载 .gif 文件的简单按钮的文档。有人可以向我解释它是如何工作的吗?
假设我想下载示例 GIF。我该怎么办?
var gif = new GIF({
workers: 2,
quality: 10
});
// add a image element
gif.addFrame(imageElement);
// or a canvas element
gif.addFrame(canvasElement, {delay: 200});
// or copy the pixels from a canvas context
gif.addFrame(ctx, {copy: true});
gif.on('finished', function(blob) {
window.open(URL.createObjectURL(blob));
});
gif.render();
解决方案
推荐阅读
- asp.net-core - 在 IIS 中托管 ASP.Net Core MVC 应用程序时出现 HTTP 500 错误
- scala - Prohibit generating of apply for case class
- python - scipy 版本可以改变 scipy.interpolate.griddata 结果吗?
- reactjs - Heroku 容器化应用程序无法运行 - 错误代码 H10
- deep-learning - Pytorch 中任意形状的前馈神经网络
- select - 将下拉列表用作 Blazorise.DataGrid 的过滤器
- intellij-idea - 如何在 IntelliJ IDEA 中更改 WildFly 版本?
- javascript - 受保护的路由无法与 React 和 Firebase 一起正常工作
- javascript - Axios GET 请求返回空对象
- javascript - 如何使用值数组从数组中动态获取对象列表