Carregar imagens JS Contexto

function loadImage(url) {
  return new Promise(r => { let i = new Image(); i.onload = (() => r(i)); i.src = url; });
}

let img = await loadImage("./my/image/path.jpg");
ctx.drawImage(img, 0, 0);
Homeless Horse