Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Get the image
- var image = document.getElementById('douglas'),
- // Make a canvas
- canvas = document.createElement('canvas'),
- data;
- canvas.height = image.height;
- canvas.width = image.width;
- // Put image on canvas
- canvas.getContext('2d').drawImage(image, 0, 0);
- // Get base64 encoded data, and un-convert it
- data = canvas.toDataURL();
- data = atob(data.slice(data.indexOf(',') + 1));
- // data is the binary data
Add Comment
Please, Sign In to add comment