Last active
February 25, 2019 19:23
-
-
Save funkyremi/97ea27b434686f4a0485b747a59afba7 to your computer and use it in GitHub Desktop.
Capture picture from videos online
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Paste the following code in your developer console | |
var canvas = document.createElement('canvas'); | |
var theVideo = document.querySelector('video'); | |
canvas.width = theVideo.videoWidth; | |
canvas.height = theVideo.videoHeight; | |
canvas.getContext('2d').drawImage(theVideo, 0, 0, theVideo.videoWidth, theVideo.videoHeight); | |
var png = canvas.toDataURL('image/png'); | |
var link = document.createElement('a'); | |
link.href = png; | |
link.setAttribute('download', 'capture.png'); | |
document.body.appendChild(link); | |
link.click(); | |
document.body.removeChild(link); | |
// OR | |
// Drag and drop the following line in your browser Bookmark toolbar | |
javascript:var canvas=document.createElement('canvas');var theVideo=document.querySelector('video');canvas.width=theVideo.videoWidth;canvas.height=theVideo.videoHeight;canvas.getContext('2d').drawImage(theVideo,0,0,theVideo.videoWidth,theVideo.videoHeight);var png=canvas.toDataURL('image/png');var link=document.createElement('a');link.href=png;link.setAttribute('download','capture.png');document.body.appendChild(link);link.click();document.body.removeChild(link); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment