blueimp has a library JavaScript-Load-Image that can modify/parse EXIF tag when loading the image. Here is the link to the code on GitHub
use the loadImage()
function and provide the orientation optional field to modify EXIF orientation value.
document.getElementById('file-input').onchange = function (e) {
loadImage(
e.target.files[0],
function (img) {
document.body.appendChild(img);
},
{orientation: 3}
);
};
Here is a list of EXIF orientation values and the specified rotation info available here:
https://beradrian.wordpress.com/2008/11/14/rotate-exif-images/
- 1 = The 0th row is at the visual top of the image, and the 0th column
is the visual left-hand side.
- 2 = The 0th row is at the visual top of the image, and the 0th column is the visual right-hand side.
- 3 = The 0th row is at the visual bottom of the image, and the 0th column is
the visual right-hand side.
- 4 = The 0th row is at the visual bottom of the image, and the 0th column is the visual left-hand side.
- 5 = The 0th row is the visual left-hand side of the image, and the 0th column is the visual top.
- 6 = The 0th row is the visual right-hand side of the image, and the 0th column is the visual top.
- 7 = The 0th row is the visual right-hand side of the image, and the 0th column is the visual bottom.
- 8 = The 0th row is the visual left-hand side of the image, and the 0th column is the visual bottom.