I want to set the height and width of canvas according to the background image.
For example, if the height and width of the image are less than screen size then canvas size is 100% of the screen and if image size is greater than screen size then canvas adjusts according to it without cutting image and show scrollbars.
Currently, I have fix the height and width of the canvas
<canvas id="canvas" width="720" height="800"></canvas>
and background image code is
canvas.setBackgroundImage('./img/form.jpg', canvas.renderAll.bind(canvas), {
});
How to make canvas height and width dynamic?