I know I can draw the whole image on canvas using:
ctx.drawImage(img,0,0,img.width,img.height,0,0,canvas.width,canvas.height);
but this will mess up the image on certain screens. I want to draw the image as it would have appeared on a div with background-size: cover
applied. Is it possible at all?
This question answered the background-size: cover
part. I want to figure out how to simulate background-position: 100% 100%
now. In other words, I want to draw the bottom right of image in the bottom right part of canvas. How can I do that?