0

I'm trying to put an image on a canvas in javascript. It is going on top of a box.

    var img = document.createElement("img");
    img.src = "linetime.png";
    img.width = 100;
    img.height = 100;

    document.body.appendChild(img);

That is the general code for calling the image. Tell me if you need more context/you need me to put the rest of the code in.

FisNaN
  • 2,517
  • 2
  • 24
  • 39

1 Answers1

0

That is the general code for calling the image. Tell me if you need more context/you need me to put the rest of the code in.

Basically You will need to "draw" the image into a canvas. https://www.w3schools.com/tags/canvas_drawimage.asp

How to add image to canvas

Chris Chen
  • 1,228
  • 9
  • 14