I want this image in my canvas but it is getting stretched and not fitting the box properly. What am I missing?
Here is my code:
var canvas = document.getElementById("canvas"),
ctx = canvas.getContext("2d");
var img = new Image();
img.src = "my image url";
img.onload = function(){
ctx.drawImage(img,0,0);
}
Please check this image: https://i.stack.imgur.com/RMZM2.png
What I want is my logo fit in the canvas box.
Here is my whole logo: https://i.stack.imgur.com/4jFjM.png