I have this simple html showing an image.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<title>Image Object Fit</title>
<style>
body {
margin: 0;
width: 100vw;
height: 100vh;
}
img {
width: 100%;
height: 100%;
object-fit: contain;
}
</style>
</head>
<body>
<img src="https://placekitten.com/200/300" alt="" />
</body>
</html>
https://jsbin.com/hapoqog/edit?html,output
The img element has different properties: width,height,offsetWidth,offsetHeight,naturalWidth,naturalHeight
but none of them give the dimensions of the rendered image correctly.
How do I calculate the width, height and scale/zoom of the rendered image?