image - 在 canvas.toDataUrl ('image/jpeg' 、0.2) 上出现错误

标签 image html canvas export jpeg

据说HTML Canvas Element Interface Gecko DOM Reference页面,即:

If the requested type is image/jpeg, then the second argument, if it is between 0.0 and 1.0, is treated as indicating image quality; if the second argument is anything else, the default value for image quality is used. Other arguments are ignored.

但在实践中我得到:安全错误”代码:“1000。

是否尚不支持某些功能?或者为什么会发生这种情况?任何有见地的建议或解释可能会有所帮助。

更新:

我使用最新的文件 API 首先将本地镜像文件加载到内存中,使用 Canvas 对其进行缩放,然后以自定义质量导出。

最佳答案

这是一个 known bug .

关于image - 在 canvas.toDataUrl ('image/jpeg' 、0.2) 上出现错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4591349/

相关文章:

javascript - 样式滚动条仅适用于 div,不适用于整个主体

javascript - "Tank Wars"游戏中随机土地的算法

javascript - Canvas 动画(window.requestAnimationFrame)

javascript - 是否可以在具有真实(真实世界)尺寸的 html Canvas 上绘制?

html - 如何使用 css,html 在 wordpress 的图像(链接)上叠加文本

python - 在 Matplotlib 中如何防止图像出现在屏幕上? Python

javascript - 将 img 标签的 src 设置为 javascript 函数的结果

javascript - 在 Jquery 中渲染图像抛出 500(内部服务器错误)

html - 如何使 div 堆叠在 "fixed positioned"元素(包含全屏背景幻灯片)的顶部?

html - Webkit 将 <details> ascendants 重置为默认盒子模型