将canvas截图保存到文件夹中

时间:2018-04-30 13:05:41

标签: javascript jquery html canvas html5-canvas

我使用画布制作了截图。现在截图想要存储成折叠。这就是我所做的。

video = document.getElementById('localVideo');
img = document.getElementById('image');

CAPTURE = document.getElementById('Capture');
CAPTURE.onclick = sendDataCAPTURE;
const canvas = document.createElement('canvas');

function sendDataCAPTURE() {
  canvas.width = video.videoWidth;
  canvas.height = video.videoHeight;
  canvas.getContext('2d').drawImage(video, 0, 0);

  img.src = canvas.toDataURL('image/png', 1);
  console.log('canvas URL' + canvas.toDataURL('image/webp'))
}

0 个答案:

没有答案