Не уверен, если вы все еще ищете ответ, но вот как:
var ctx = document.getElementById('your_canvas').getContext("2d");
//ctx.lineWidth = 13;
//ctx.strokeStyle = 'rgba(0,0,0,1)';
//ctx.fillStyle="rgba(0,0,0,0)" // if using this, make sure alpha < 1
ctx.arc(100,100, 50, 0, Math.PI*2,true); // you can use any shape
ctx.clip();
var img = new Image();
img.addEventListener('load', function(e) {
ctx.drawImage(this, 0, 0, 200, 300);
//ctx.fill();
//ctx.stroke();
}, true);
img.src="/path/to/image.jpg";
Вы также можете сделать это с рисунком, но вы получаете меньшую гибкость размещения изображения
ctx.arc(100,100, 70, 0, Math.PI*2,true);
ctx.clip();
img = new Image()
img.addEventListener('load', function(e) {
ctx.fillStyle = ctx.createPattern(this, 'no-repeat')
ctx.fill();
}, true);
img.src="/path/to/image.jpg"