Git Product home page Git Product logo

exiv2node's Introduction

#Exiv2

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

Dependencies

To build this addon you'll need the Exiv2 library and headers so if you're using a package manager you might need to install an additional "-dev" packages.

Debian

apt-get install libexiv2 libexiv2-dev

OS X

You'll also need to install pkg-config to help locate the library and headers.

MacPorts:

port install pkgconfig exiv2

Homebrew:

brew install pkg-config exiv2

Other systems

See the Exiv2 download page for more information.

Installation Instructions

Once the dependencies are in place, you can build and install the module using npm:

npm install exiv2

You can verify that everything is installed and operating correctly by running the tests:

npm test

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', newTags, function(err){
  if (err) {
    console.error(err);
  } else {
    console.log("setImageTags complete..");
  }
});

Delete tags:

var ex = require('exiv2')

var tagsToDelete = ["Exif.Photo.UserComment", "Exif.Canon.OwnerName"];
ex.deleteImageTags('./photo.jpg', tagsToDelete, function(err){
  if (err) {
    console.error(err);
  } else {
    console.log("deleteImageTags complete..");
  }
});

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

email: dberesford at gmail twitter: @dberesford

exiv2node's People

Contributors

dberesford avatar drewish avatar rbdr avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Forkers

avgeeklucky

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.