JSFiddle - React, Tailwind, and code Playground

HTML

<canvas id='a' width='32' height='32'></canvas>
<canvas id='a' width='64' height='64'></canvas>
<canvas id='b' width='256' height='256'></canvas>
<canvas id='b' width='512' height='512'></canvas>

CSS

canvas, img {
    border: 5px solid #ddd;
}

JavaScript

var img = new Image();
img.src = 'http://upload.wikimedia.org/wikipedia/commons/f/f0/Pixelart-tv-iso.png';

img.onload = function () { 
    $('canvas').each(function () {
        var ctx = this.getContext("2d");
        ctx.scale(this.width/64, this.height/64);
        ctx.fillStyle = ctx.createPattern(img, 'repeat');
        ctx.fillRect(0, 0, 64, 64);
    });
};