Skip to content

Instantly share code, notes, and snippets.

@krutz27
Created October 4, 2013 13:32
Show Gist options
  • Select an option

  • Save krutz27/6825978 to your computer and use it in GitHub Desktop.

Select an option

Save krutz27/6825978 to your computer and use it in GitHub Desktop.
//CONVERTS AN IMAGE TO CANVAS
// Converts image to canvas; returns new canvas element
function convertImageToCanvas(image) {
var canvas = document.createElement("canvas");
canvas.width = image.width;
canvas.height = image.height;
canvas.getContext("2d").drawImage(image, 0, 0);
return canvas;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment