Skip to content

Commit

Permalink
Update the readme.
Browse files Browse the repository at this point in the history
Adding an example for getImagePreviews(). Switched the links to the
proper markdown syntax. Split up the examples to make them more readable.
  • Loading branch information
drewish committed May 21, 2012
1 parent e6ce7bf commit 656926c
Showing 1 changed file with 35 additions and 11 deletions.
46 changes: 35 additions & 11 deletions README.md
Original file line number Original file line Diff line number Diff line change
@@ -1,11 +1,17 @@


##Exiv2 #Exiv2


Exiv2 is a native c++ extension for node.js that provides asynchronous support for reading & writing image metadata via Exiv2 (http://www.exiv2.org). Exiv2 is a native c++ extension for [node.js](http://nodejs.org/) that provides
asynchronous support for reading & writing image metadata via
[Exiv2 library](http://www.exiv2.org).


## Dependencies ## Dependencies


Needs Exiv2, see http://www.exiv2.org/download.html. To build this addon you'll need the Exiv2 library and headers, see
[their download page](http://www.exiv2.org/download.html) for more information.

The tests are written using [Mocha](https://github.com/visionmedia/mocha) and
[Should](https://github.com/visionmedia/should.js).


## Installation Instructions ## Installation Instructions


Expand All @@ -20,28 +26,46 @@ Install the module with npm:


## Sample Usage ## Sample Usage


### Read tags:

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


ex.getImageTags('./photo.jpg', function(err, tags) { ex.getImageTags('./photo.jpg', function(err, tags) {
if (err) {
console.log(err);
} else {
console.log(tags);

console.log("DateTime: " + tags["Exif.Image.DateTime"]); console.log("DateTime: " + tags["Exif.Image.DateTime"]);
console.log("DateTimeOriginal: " + tags["Exif.Photo.DateTimeOriginal"]); console.log("DateTimeOriginal: " + tags["Exif.Photo.DateTimeOriginal"]);
}
}); });


ex.setImageTags('./photo.jpg', { "Exif.Photo.UserComment" : "Some Comment..", "Exif.Canon.OwnerName" : "My Camera"}, function(err){ ### 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) { if (err) {
console.log(err); console.log(err);
} else { } else {
console.log("setImageTags complete.."); console.log("setImageTags complete..");
} }
}); });


See `example/simple.js`. Take a look at the `examples/` and `test/` directories for more.


email: dberesford at gmail email: dberesford at gmail
twitter: @dberesford twitter: @dberesford

0 comments on commit 656926c

Please sign in to comment.