JSFiddle - React, Tailwind, and code Playground

by al3x88

HTML

<script src="https://rawgithub.com/kangax/fabric.js/master/dist/fabric.js"></script>
<!DOCTYPE html>
<html>
<body>

<p>Image to use:</p>
<img id="scream" src="https://static.fjcdn.com/large/pictures/03/b1/03b120_799520.jpg" alt="The Scream">

<p>Canvas:</p>
<canvas id="myCanvas" width="400" height="400" style="border:1px solid #d3d3d3;">
Your browser does not support the HTML5 canvas tag.
</canvas>

<p><strong>Note:</strong> The canvas tag is not supported in Internet 
Explorer 8 and earlier versions.</p>

</body>
</html>

JavaScript

var c = document.getElementById("myCanvas");
var ctx = c.getContext("2d");
var img = document.getElementById("scream");
ctx.drawImage(img, 10, 10);