HTML5 Canvas.toDataURL的默认质量是多少?

根据mozilla,canvas.toDataURL(1,2)的第二个参数是:

If the requested type is image/jpeg or image/webp,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.

但我无法找到告诉我认值实际是什么的任何地方.

解决方法

根据 spec,它暗示认是依赖于浏览器:

The second argument,if it is a number in the range 0.0 to 1.0 inclusive,must be treated as the desired quality level. If it is not a number or is outside that range,the user agent must use its default value,as if the argument had been omitted.

编辑:根据one user,Firefox的认值为0.92.

You can specify the JPEG quality as the second parameter to the toDataURL function. The default quality in Firefox is 0.92 (92%).

根据这个webkit bug report Chrome使用相同的.

…Adds a libjpeg-based image encoder for Skia bitmaps. Default encoding quality is 92 to match Mozilla…

相关文章

HTML5和CSS3实现3D展示商品信息的代码
利用HTML5中的Canvas绘制笑脸的代码
Html5剪切板功能的实现
如何通过HTML5触摸事件实现移动端简易进度条
Html5移动端获奖无缝滚动动画实现
关于HTML5和CSS3实现机器猫的代码