Skip to content

Instantly share code, notes, and snippets.

@Kreijstal
Created October 6, 2014 07:28
Show Gist options
  • Save Kreijstal/1ca05511126c04312e8a to your computer and use it in GitHub Desktop.
Save Kreijstal/1ca05511126c04312e8a to your computer and use it in GitHub Desktop.
gets base64 uri of image
function getDrawURL(){
var img=document.createElement('img'),canvas=document.createElement('canvas'),context=canvas.getContext('2d');
img.src='http://fc05.deviantart.net/fs70/i/2013/357/c/8/my_teenage_pony_by_kilala97-d6z4jke.jpg';
canvas.height=img.height;
canvas.width=img.width;
context.drawImage(img,0,0)
return canvas.toDataURL('image/png');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment