JSFiddle - React, Tailwind, and code Playground
HTML
<canvas id="display" width="1000px" height="100px"></canvas>
JavaScript
function objectifyImage(i) {
var img_obj = new Image();
img_obj.src = i;
return img_obj;
}
var canvas = document.getElementById('display');
var context = canvas.getContext('2d');
i = objectifyImage('https://www.google.co.uk/images/srpr/logo3w.png');
i.onload = function() {
$('#display').width(i.width).height(i.height);
context.drawImage(i, 0, 0);
};