Created
November 28, 2016 19:38
-
-
Save vankasteelj/f148eb5526580c8dec910fdd16057310 to your computer and use it in GitHub Desktop.
Freez gif js code
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
var freezeGif = function (img) { | |
return new Promise(function (resolve) { | |
var i = new Image(); | |
i.src = img; | |
i.onload = function () { | |
var c = document.createElement('canvas'); | |
var w = c.width = i.width; | |
var h = c.height = i.height; | |
c.getContext('2d').drawImage(i, 0, 0, w, h); | |
resolve(c.toDataURL('image/gif')); | |
}; | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
input url to a gif, output a b64encoded image