Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>JS Bin</title>
</head>
<body>
<body>
<canvas id = "idCanvas" width = "576" height = "577"> </canvas>
<img id="canvasImg" width = "576" height = "577" src=""></img>
<script>
window.onload = function(){
  var canvas = document.getElementById('idCanvas');
  var context = canvas.getContext('2d');
  var imageObj = new Image();
  //var dataURL = canvas.toDataURL();
  imageObj.onload = function() {
    context.drawImage(imageObj, 0, 0, 576, 577);
    context.font = "20px Calibri";
    context.fillText("My TEXT!", 50, 100);
    document.getElementById('canvasImg').setAttribute('crossOrigin', 'anonymous');
    console.log(document.getElementById('canvasImg'));
    
    document.getElementById('canvasImg').src = canvas.toDataURL();
    //window.alert(dataURL);
  };
  imageObj.src =  "http://static.jsbin.com/images/dave.min.svg";
  };
</script>
</body>
</html>
Output

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

Dismiss x
public
Bin info
anonymouspro
0viewers