When I call context.drawImage in Chrome 81+ it will auto-rotate the image. I want to disable this. I can disable it in an img tag using image-orientation:none, but that doesn't work on a canvas.
It seems to ignore the image-orientation style. In this example below, img tag does not get auto-rotated (as expected), but the canvas does, despite trying to disable it.
How do you prevent drawImage from rotating based on exif data, or at least detect that it has done so?
<html>
<head>
<script>
window.onload = function() {
var c = document.getElementById("myCanvas");
var ctx = c.getContext("2d");
var img = document.getElementById("imgtest");
// This style is ignored
img.style.imageOrientation = 'none';
ctx.drawImage(img, 0, 0);
};
</script>
</head>
<body>
<p>
<img id="imgtest" style="image-orientation:none;" src="portrait.jpg"/>
<canvas id="myCanvas" width="240" height="297"></canvas>
</p>
</body>
</html>