Permalink
Browse files

Added Makernote extraction for Epson

  • Loading branch information...
1 parent 7a30b51 commit f54a475fbf1bae9a020b3dc7458a92886abd0172 @gomfunkel committed May 8, 2011
Showing with 73 additions and 0 deletions.
  1. +2 −0 lib/exif/ExifImage.js
  2. +71 −0 lib/exif/makernotes/epson.js
@@ -242,6 +242,8 @@ ExifImage.prototype.extractExifData = function (data, start, length, callback) {
this.extractMakernotes = require('./makernotes/olympus').extractMakernotes;
} else if (this.exifData.exif[exifEntry].value.getString(0, 7) === "AGFA \x00\x01") {
this.extractMakernotes = require('./makernotes/agfa').extractMakernotes;
+ } else if (this.exifData.exif[exifEntry].value.getString(0, 8) === "EPSON\x00\x01\x00") {
+ this.extractMakernotes = require('./makernotes/epson').extractMakernotes;
} else {
// Makernotes are available but the format is not recognized so
// an error message is pushed instead, this ain't the best
@@ -0,0 +1,71 @@
+/**
+ * Extracts Epson flavored Makernotes which are equal to those of Olympus.
+ */
+exports.extractMakernotes = function (data, makernoteOffset, tiffOffset) {
+
+ var makernoteData = [];
+
+ // List of vendor specific Makernote tags found on
+ // http://www.ozhiker.com/electronics/pjmt/jpeg_info/makernotes.html
+ var tags = {
+
+ 0x0000 : 'Makernote Version',
+ 0x0001 : 'Camera Settings',
+ 0x0003 : 'Camera Settings',
+ 0x0040 : 'Compressed Image Size',
+ 0x0081 : 'Minolta Thumbnail Offset',
+ 0x0088 : 'Minolta Thumbnail Offset',
+ 0x0089 : 'Minolta Thumbnail Length',
+ 0x0101 : 'Colour Mode',
+ 0x0102 : 'Image Quality',
+ 0x0103 : 'Image Quality',
+ 0x0200 : 'Special Mode',
+ 0x0201 : 'JPEG Quality',
+ 0x0202 : 'Macro',
+ 0x0204 : 'Digital Zoom',
+ 0x0207 : 'Firmware Version',
+ 0x0208 : 'Picture Info Data',
+ 0x0209 : 'Camera ID',
+ 0x020B : 'Image Width',
+ 0x020C : 'Image Height',
+ 0x020D : 'Original Manufacturer Model',
+ 0x0E00 : 'Print Image Matching Info PIM',
+ 0x1004 : 'Flash Mode',
+ 0x1006 : 'Bracket',
+ 0x100B : 'Focus Mode',
+ 0x100C : 'Focus Distance',
+ 0x100D : 'Zoom Numeric',
+ 0x100E : 'Macro Focus',
+ 0x100F : 'Sharpness Numeric',
+ 0x1011 : 'Colour Matrix',
+ 0x1012 : 'Black Level',
+ 0x1015 : 'White Balance',
+ 0x1017 : 'Red Bias',
+ 0x1018 : 'Blue Bias',
+ 0x101A : 'Serial Number',
+ 0x1023 : 'Flash Bias',
+ 0x1029 : 'Contrast',
+ 0x102A : 'Sharpness Factor',
+ 0x102B : 'Colour Control',
+ 0x102C : 'Valid Bits',
+ 0x102D : 'Coring Filter',
+ 0x102E : 'Final Width',
+ 0x102F : 'Final Height',
+ 0x1034 : 'Compression Ratio',
+
+ };
+
+ // Epson flavored Makernote data starts after eight bytes
+ var ifdOffset = makernoteOffset + 8;
+
+ // Get the number of entries and extract them
+ var numberOfEntries = data.getShort(ifdOffset, this.isBigEndian, tiffOffset);
+
+ for (var i = 0; i < numberOfEntries; i++) {
+ var exifEntry = this.extractExifEntry(data, (ifdOffset + 2 + (i * 12)), tiffOffset, tags);
+ if (exifEntry) makernoteData.push(exifEntry);
+ }
+
+ return makernoteData;
+
+};

0 comments on commit f54a475

Please sign in to comment.