Skip to content

Instantly share code, notes, and snippets.

@jamesflorentino
Created February 5, 2012 19:57
Show Gist options
  • Save jamesflorentino/1747707 to your computer and use it in GitHub Desktop.
Save jamesflorentino/1747707 to your computer and use it in GitHub Desktop.
function saveImage(canvasId) {
var canvas = document.getElementById(canvasId);
var dataUrl = canvas.toDataURL("image/png");
return dataUrl;
}
// example
// <canvas id="myCanvas" />
var imageUrl = saveImage('myCanvas');
window.location = imageUrl;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment