Skip to content

Instantly share code, notes, and snippets.

@klaemo
Created May 13, 2015 13:19
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 klaemo/61ff0bc2fd3b81490be6 to your computer and use it in GitHub Desktop.
Save klaemo/61ff0bc2fd3b81490be6 to your computer and use it in GitHub Desktop.
fast image rendering in the browser
var context = canvas.getContext('2d')
var img = new Image()
img.onload = function() {
context.drawImage(img, 0, 0)
window.URL.revokeObjectURL(this.src)
}
img.src = window.URL.createObjectURL(new Blob([data], {'type': 'image\/jpeg'}))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment