Is there a javascript mechanism to modify EXIF metadata information of Image?
exif, javascript, metadata
Solution
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.
Problem
I am looking for a JavaScript mechanism to modify the image EXIF metadata info, I found plenty of JS libraries that allow me to retrieve EXIF info, but none that modify. I am looking to modify EXIF orientation information for the image, then save it.