Skip to content

Instantly share code, notes, and snippets.

@dniswhite
Last active August 29, 2015 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dniswhite/353f8c7f673728637639 to your computer and use it in GitHub Desktop.
Save dniswhite/353f8c7f673728637639 to your computer and use it in GitHub Desktop.
load base64 into canvas element
function convertBase64toImage(id, image64) {
var canvas = document.createElement(id);
var context = canvas..getContext('2d');
var baseImage = new Image();
baseImage.onload() = function() {
context.drawImage(baseImage, 0, 0);
};
baseImage.src = image64;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment