JSFiddle - React, Tailwind, and code Playground
by oleg3190
HTML
<!doctype html>
<html>
<meta charset='utf-8'>
<head>
<title>imgExample</title>
</head>
<body>
<canvas id='example'>Обновите браузер</canvas>
<script>
var example = document.getElementById("example"),
ctx = example.getContext('2d'), // Контекст
pic = new Image(); // "Создаём" изображение
pic.src = 'http://habrahabr.ru/i/nocopypast.png'; // Источник изображения, позаимствовано на хабре
pic.onload = function() { // Событие onLoad, ждём момента пока загрузится изображение
ctx.drawImage(pic, 100, 42, 100, 100,);
}
</script>
</body>
</html>