0

I try to add text to image, but I fail. Anyone can help me. thanks!

function myCanvas() {
  var c = document.getElementById("myCanvas");
  var ctx = c.getContext("2d");
  var img = document.getElementById("Tshirtsrc");
  ctx.drawImage(img, 3, 3, 350, 350);
  ctx.fillStyle = "red";
  ctx.font = "18px sans-serif";
  ctx.fillText("This is a test", 50, 400);
}
Shikkediel
  • 5,195
  • 16
  • 45
  • 77
Binh Huynh
  • 15
  • 8

0 Answers0