I am writing a webapp which loads the image and display on canvas (more exact, I am writing a Tizen app which uses HTML5/JavaScript).
I can load the image properly:
function loadImage(file) {
var img = new Image();
img.src = file;
return img;
}
Everything works fine until I started to get images which display in wrong orientation. I figure out how to get the EXIF and orientation, and I was wondering how do I change the above function to return a proper image?
function loadImage(file) {
var img = new Image();
img.src = file;
// Retrieve EXIF orientation (works fine)
...
// What should I do here to rotate the img?
return img;
}
I have been looking around and others are suggesting drawing the image rotated in canvas, but that causes a lot of problems in my calculation (where the x, y are not in 0, 0, width and height are not the same size as the canvas).
Try this
Try: