When i draw an image in a canvas, i have to specify the canvas width and height so it matches with the image size that im trying to paint.
<script>
window.onload = function() {
var canvas = document.getElementById("myCanvas");
var context = canvas.getContext("2d");
var imageObj = new Image();
imageObj.onload = function() {
context.drawImage(imageObj, 0, 0);
};
imageObj.src = "<%=image_path('logo.jpg')%>";
};
</script>
<canvas id="myCanvas" width="700" height="400"></canvas>
specifying the canvas width and height is not so good because i might need to use different values than those depending on the resolution of the screen, i need to work on proportions, so i would like to know how to handle this and also how to paint an image without having to specify the width and height to the canvas.