我有代码从视频中绘制图像.这是代码
<script type="text/javascript">
function capture() {
var video = document.getElementById("videoId");
var canvas = capture(video, 1);
var dataURL = canvas.toDataURL("image/bmp", 1.0);
console.log("dataurl: "+dataURL);
}
</script>
<body>
<input type="button" value="Capture" onClick="capture()"/>
<video id="videoId" width="640" height="480"/>
</body>
Run Code Online (Sandbox Code Playgroud)
在控制台上,dataurl显示为"data:image/png; base64,..."
题?
为什么dataurl是以png格式生成的?
注意:这发生在chrome浏览器[41.0.2272.89]中.在firefox中,url是以bmp格式生成的.