mattburns / exiftool.js

A pure javascript implementation of exiftool
MIT License
64 stars 13 forks source link

Package and publish as node module #2

Closed mattburns closed 10 years ago

redaktor commented 10 years ago

Just in case you publish it to npm, I would recommend to maintain "sample images" in an own repo and just npm install sample images with the --dev flag...

mattburns commented 10 years ago

Thanks. I just noticed you commenting on another project: https://github.com/gomfunkel/node-exif When I get a chance I'll take a look at that, and compare coverage. It would make sense to merge efforts into one project...

redaktor commented 10 years ago

:+1: yeah - that was what I was thinking too !!! I was just to shy to write it ;)

The "metadata support" in node.js is one thing which has to be improved - Existing libraries either require projects in other languages over CLI - or they do not use the benefits of node.js ( there is one : https://github.com/sujal/node-image-headers ) - so we should take that in account. The author was also commenting on the "gomfunkel" project. I think it is a nice pull request from 10 month ago but it was not merged (?)

So let me tell you what I want to achieve (by the help of other nice people) : I want to write a dojo module which is "native npm" and amd compatible and can use streams. First focus is node.js (dojo/node) but it should be usable with filerReader on the client as well. We do always try to contribute to "root projects" first.

Currently I am preparing a short demo. I will tell you later: redaktor.meta (regarding images) deals with XMP already and I am working on the deprecated IPTC IIM although I don't know any colleagues who still use them (XMP is more important). However that's easy. I'll tell you later - What is much more complicated is the EXIF, well not the EXIF core but the "Makernotes". These are most of the "uncovered tags" here. (http://sno.phy.queensu.ca/~phil/exiftool/TagNames/)

It would make most sense to work together first to implement this "vendor wars" tags. You can see an example which should work for gomfunkel's project here: Canon : https://gist.github.com/redaktor/bae0ef2377ab70bc5276

mattburns commented 10 years ago

Excellent work on your Canon Makernotes gist. This is how the final solution should be built. It allows people to contribute improvements for each manufacturer more easily.

My plan was to simply compare the output of my exiftool.js with the output from Phil Harvey's perl-based exiftool. I consider that to be the most complete exif parser by far. Have you seen my test harness that compares the outputs? When I get some time, I will add the output from the gomfunkel project in there too so that we can compare coverage.

I'm the creator of www.stolencamerafinder.com so know quite a lot about exif but I'm historically a Java programmer so quite new to node/dojo etc.

redaktor commented 10 years ago

Yeah cool. There were some bugs in the gist. Fixed now. Nikon is 80% ready as well. Maybe you could wait until some more are done. I would create a squash commit for gomfunkel then. So that the files go in the "makernotes" folder there and you can test. If it does not get merged, I will send you a preview of redaktor.meta (on node.js for "readStreams", see http://maxogden.com/node-streams.html). btw: stolencamerafinder is a really cool idea. Luckily since the digital ages began no more cameras were stolen (really had much to do to pay attention ;) ) - just added you on google+ [sebastian]

redaktor commented 10 years ago

if you want to test the makernotes with gomfunkels ... now, you need to "require" the files in ExifImage.js (see around line 260) like so:

if (typeof makerNoteValue.getString != "undefined") {
        // Check the header to see what kind of Makernote we are dealing with
        if (makerNoteValue.getString(0, 7) === "OLYMP\x00\x01" || makerNoteValue.getString(0, 7) === "OLYMP\x00\x02") {
            this.extractMakernotes = require('./makernotes/olympus').extractMakernotes;
        } else if (makerNoteValue.getString(0, 7) === "AGFA \x00\x01") {
            this.extractMakernotes = require('./makernotes/agfa').extractMakernotes;
        } else if (makerNoteValue.getString(0, 8) === "EPSON\x00\x01\x00") {
            this.extractMakernotes = require('./makernotes/epson').extractMakernotes;
        } else if (makerNoteValue.getString(0, 8) === "FUJIFILM") {
            this.extractMakernotes = require('./makernotes/fujifilm').extractMakernotes;
        } else if (makerNoteValue.getString(0, 5) === "SANYO") {
            this.extractMakernotes = require('./makernotes/sanyo').extractMakernotes;
        } else if (makerNoteValue.getString(0, 5) === "Nikon") {
            this.extractMakernotes = require('./makernotes/nikon').extractMakernotes;
        } else if (makerNoteValue.getString(0, 4) === "%\u0000\u0001\u0000") {
            this.extractMakernotes = require('./makernotes/canon').extractMakernotes;
        } else {
            // Makernotes are available but the format is not recognized so
            // an error message is pushed instead, this ain't the best
            // solution but should do for now
            this.exifData.makernote['error'] = makerNoteValue.getString(0, 4)+'Unable to extract Makernote information as it is in an unsupported or unrecognized format.';
        }

        if (typeof this.exifData.makernote['error'] == "undefined") {
            this.exifData.makernote = this.extractMakernotes(data, self.makernoteOffset, tiffOffset);
        }
    }

(Canon has no signature and data starts immediately)

redaktor commented 10 years ago

@mattburns Hm, having a problem with Nikon. gomfunkels node-exif is parsing the Nikon makernotes fine but they have no values, e.g.

{ tag: <Buffer 13 00>,
  tagId: 19,
  tagName: 'ISOSetting',
  format: 35852,
  components: 0,
  valueOffset: null,
  value: [] },
{ tag: <Buffer 01 00>,
  tagId: 1,
  tagName: 'MakerNoteVersion',
  format: 4354,
  components: 0,
  valueOffset: null,
  value: [] },
{ tag: <Buffer 94 00>,
  tagId: 148,
  tagName: 'Saturation',
  format: 34452,
  components: 0,
  valueOffset: null,
  value: [] }

any idea ?

mattburns commented 10 years ago

It won't be until next week I'll have time to take a look. I just looked at whether my parser extracts the "saturation" tag from nikon cameras and it works fine. http://mattburns.github.io/exiftool.js/report/sampleImages-Nikon.html

On 2 May 2014 15:49, redaktor notifications@github.com wrote:

@mattburns https://github.com/mattburns Hm, having a problem with Nikon. gomfunkels node-exif is parsing the Nikon makernotes fine but they have no values, e.g.

{ tag: <Buffer 13 00>, tagId: 19, tagName: 'ISOSetting', format: 35852, components: 0, valueOffset: null, value: [] }, { tag: <Buffer 01 00>, tagId: 1, tagName: 'MakerNoteVersion', format: 4354, components: 0, valueOffset: null, value: [] }, { tag: <Buffer 94 00>, tagId: 148, tagName: 'Saturation', format: 34452, components: 0, valueOffset: null, value: [] }

any idea ?

— Reply to this email directly or view it on GitHubhttps://github.com/mattburns/exiftool.js/issues/2#issuecomment-42039746 .

redaktor commented 10 years ago

@mattburns Saturation is a bad example because it is present in the native EXIF as 0xA409 - that is fine for me as well.

But here I was looking in Nikon makernotes for the Saturation: 0x0094 I am following the exiftool tables ( http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/Nikon.html ) Nevermind. I'll investigate ;)

redaktor commented 10 years ago

OK, @mattburns - two more gists ... ;) Replacement for gomfunkel node-exif : https://gist.github.com/redaktor/c3683f49cab545e91729 I contributed the "formatting functions" we ported from exiftool .pm to .js. You will find them in TAGS.ref. Nikon makernotes :8ball: it does not print the serial number yet. You are the expert ... https://gist.github.com/redaktor/cdd29b93f90b893649a2

mattburns commented 10 years ago

Ok, great stuff. I've spent a little time tidying everything up. exiftool.js is now published on npm here: https://www.npmjs.org/package/exiftool.js

I have a test harness thing that generates a coverage report. I've added exiftool.js, node-exif, and your gists into the same report so you can compare outputs. Your gists are certainly improving the coverage. You can see the comparison here: http://mattburns.github.io/exiftool.js/test/generated/reports/

At the moment I've just hacked in your changes into my repository so that I can generate that report. Let me know if you ever package it up into its own project, or it gets folded into node-exif.

This comment thread isn't the ideal place to continue this conversation. Feel free to contact me by email: matt@mattburns.co.uk

Cheers, Matt