Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Exiv2 support for Node.js
C++ JavaScript Python
tree: a76abb83ab

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
examples
test
.gitignore
AUTHORS
LICENSE
README.md
exiv2.js
exiv2node.cc
package.json
wscript

README.md

Exiv2

Exiv2 is a native c++ extension for node.js that provides asynchronous support for reading & writing image metadata via Exiv2 library.

Dependencies

To build this addon you'll need the Exiv2 library and headers. On Debian/Ubuntu, sudo apt-get install exiv2 libexiv2-dev. See the Exiv2 download page for more information.

The tests are written using Mocha and Should.

Installation Instructions

Install the library and headers using package manager appropriate to your system:

  • Debian: apt-get install libexiv2 libexiv2-dev
  • OS X: port install exiv2

Install the module with npm:

npm install exiv2

Sample Usage

Read tags:

var ex = require('exiv2');

ex.getImageTags('./photo.jpg', function(err, tags) {
  console.log("DateTime: " + tags["Exif.Image.DateTime"]);
  console.log("DateTimeOriginal: " + tags["Exif.Photo.DateTimeOriginal"]);
});

Load preview images:

var ex = require('exiv2')
  , fs = require('fs');

ex.getImagePreviews('./photo.jpg', function(err, previews) {
  // Display information about the previews.
  console.log(previews);

  // Or you can save them--though you'll probably want to check the MIME
  // type before picking an extension.
  fs.writeFile('preview.jpg', previews[0].data);
});

Write tags:

var ex = require('exiv2')

var newTags = {
  "Exif.Photo.UserComment" : "Some Comment..",
  "Exif.Canon.OwnerName" : "My Camera"
};
ex.setImageTags('./photo.jpg', , function(err){
  if (err) {
    console.log(err);
  } else {
    console.log("setImageTags complete..");
  }
});

Take a look at the examples/ and test/ directories for more.

email: dberesford at gmail twitter: @dberesford

Something went wrong with that request. Please try again.