JSFiddle - React, Tailwind, and code Playground
HTML
<!DOCTYPE html>
<html>
<head>
<style>
</style>
</head>
<body>
<p>Drag me</p>
<canvas id="paint_area"></canvas>
</body>
</html>
JavaScript
var can = document.getElementById('paint_area');
var ctx = can.getContext('2d');
//ctx.fillStyle = '#cc3300';
var img_buffer = document.createElement('img');
img_buffer.onload = function() {
var imgWidth=img_buffer.width;
var imgHeight=img_buffer.height;
can.width= imgWidth;
can.height=imgHeight;
ctx.drawImage(img_buffer,0,0,imgWidth,imgHeight);
}
img_buffer.src = 'http://www.jobcons.in/homebanner.jpg';