Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>
</head>
<body>
<img id="img001" width="200" height="200" src="http://static.jsbin.com/images/dave.min.svg">
</body>
</html>
 
var canvas = document.createElement('canvas');
var height = 200;
var width  = 200;
canvas.width  = width;
canvas.height = height;
var ctx = canvas.getContext('2d');
var img = document.getElementById("img001");
ctx.drawImage(img, 0, 0);
canvas.toBlob(function (blob) {
  var reader = new FileReader();
  reader.onloadend = function () {
    console.log(reader.result);
  };
  reader.readAsBinaryString(blob);
}); 
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
anonymouspro
0viewers