Name: exif-parser
Owner: Mozilla-B2G
Description: Amazing exif parser
Created: 2013-08-23 22:40:06.0
Updated: 2017-06-05 19:55:45.0
Pushed: 2016-01-25 21:00:26.0
Homepage: null
Size: 10662
Language: JavaScript
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
It provides an API to read and write EXIF metadata from jpeg images.
Download the library and include it in your html.
ipt src="js/jpeg.js"></script>
The following code loads a file, reads the exif metadata, modifies the rotation tag and creates a new blob with the new metadata.
ipt>
r readExif = function(fileBlob) {
JPEG.readExifMetaData(fileBlob, function(error, metaData) {
console.log(JSON.stringify(metaData))
});
r writeExif = function(fileBlob) {
JPEG.writeExifMetaData(
fileBlob,
{"Orientation" : 1},
function(error, modifiedBlob) {
// Process modified file
});
r processImage = function() {
var request = new XMLHttpRequest();
request.open("GET", "/exif-parser/examples/images/sample.jpg", true);
request.responseType = "arraybuffer";
request.onload = function (event) {
var arrayBuffer = request.response; // Note: not request.responseText
var blob = new Blob([arrayBuffer],{type: "image/jpeg"});
readExif(blob);
writeExif(blob);
};
request.send(null);
ocessImage();
ript>