var canvas = document.getElementById("myCanvas");
var ctx = canvas.getContext("2d");
var w = window.canvas.width;
var h = window.canvas.height;
ctx.clearRect(0,0,w,h);
var image = new Image();
image.onload = function() {
var pattern = ctx.createPattern(image,'repeat');
ctx.fillStyle=pattern;
ctx.fillRect(0,0,385,255);
};
image.src = 'https://img.webme.com/pic/o/okulsa/s1.png';