mozilla-b2g/exif-parser

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

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

exif-parser

It provides an API to read and write EXIF metadata from jpeg images.

Try it
Use it

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>
Test it

This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.