Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<script src="http://zeptojs.com/zepto.min.js"></script>
<meta charset=utf-8 />
<title>JS Bin</title>
</head>
<body>
  
  <hr>
  <canvas id="canvas1" width="400" height="200"></canvas>
  <br>
    <label> Please enter some text : </label><br>
  <textarea rows="10" cols="50"> Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</textarea>
  <div id="full_image"></div>
</body>
</html>
 
// Images used are 200px X 200px
var context = document.getElementById("canvas1").getContext("2d");
var img1 = new Image();
img1.src = "https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcRckwTqOS6QNA38iTUTPdGA6OpDFpWCZAE2o0bENkLRdguLjPv_";
var img2 = new Image();
img2.src = "https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcRKEM8dRKPPegdwqODTdsZ6zUHlJkm4HAqRIu8WRM4s-JrA1u_p";
  
img1.onload = function() {
  context.drawImage(img1, 0, 0);
  context.font="20px Calibri";
  context.fillStyle = 'red';
  context.fillText("AAAA",40,img1.height+20);
};
img2.onload = function() {
  context.drawImage(img2,img1.width,0);
  context.font="20px Calibri";
  context.fillStyle = 'green';
  context.fillText("BBBB",img1.width + 60,img1.height+20);
  
  var canvas = document.getElementById("canvas1");
  //var img = canvas.toDataURL("image/png");
  var img = canvas.toDataURL().replace(/data:image\/png;base64,/,'');
   alert("here");
  $('#full_image').html('<img src="' + img + '"/>');
   
  
};
 
Output

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

Dismiss x