I'm using ImageCapture api to capture a screenshoot from a camera of a user device.
The problem is that photos taken on android get rotated incorrectly. They are rotated incorrectly both in the photo preview, before the image is uploaded, and after it is uploaded.
My plan was to read the exif data from a blob that I get from image capture, find orientation in exif and use javascript to rotate the image correctly, but there is no usable exif data because it isnt jpg.
My code:
function takePhoto(img) {
imageCapture.takePhoto()
.then(blob => {
// EXIF.getData(blob, function() {
// myData = this;
// console.log( myData );
// });
let url = window.URL.createObjectURL(blob);
img.src = url;
console.log( blob );
// stop the camera and hide canavas
stream.getVideoTracks()[0].stop();
$("#webcam").hide();
image = blob;
$("#photo-info").slideDown('slow');
})
.catch(function (error) {
console.log(error);
});
};
takePhoto(document.querySelector('#camera-feed'));
Is there a way to detect if a image is rotated incorrectly when using ImageCapture?