Have uploaded my work to
https://codepen.io/rexyjoseph90/pen/rLqpdq
-----------------------------------------------------------------
CSS
#canvas{width: 100%;height: 100%;background-color: #f2f2f2;}
-----------------------------------------------------------------
JAVASCRIPT
$(window).resize(function(){
$("#canvas").width($(window).width());
$("#canvas").height($(window).height());
});
var canvasid = document.getElementById("canvas").getContext("2d");
var imgobj = new Image();
imgobj.src = "images/canvasobj.png";
imgobj.onload = function(){
canvasid.drawImage(imgobj,0,0);
}
-----------------------------------------------------------------
HTML
<canvas id="canvas"></canvas>
On resize i want the change the height and width of canvas but on resize the image gets distorted. How can i keep the height and width constant on resize and some images should be responsive.