gomfunkel / node-exif

A node.js library to extract Exif metadata from images.
MIT License
581 stars 104 forks source link

Fails with small images? #4

Closed Jellyfrog closed 11 years ago

Jellyfrog commented 12 years ago
buffer.js:516
  if (end > this.length) throw new Error('oob');
                               ^
Error: oob
    at Buffer.slice (buffer.js:516:32)
    at ExifImage.extractExifEntry (/usr/home/node/anon/node_modules/exif/lib/exif/ExifImage.js:243:14)
    at ExifImage.extractExifData (/usr/home/node/anon/node_modules/exif/lib/exif/ExifImage.js:167:25)
    at ExifImage.processImage (/usr/home/node/anon/node_modules/exif/lib/exif/ExifImage.js:100:9)
    at /usr/home/node/anon/node_modules/exif/lib/exif/ExifImage.js:69:10
    at [object Object].<anonymous> (fs.js:115:5)
    at [object Object].emit (events.js:64:17)
    at afterRead (fs.js:1112:12)
    at Object.wrapper [as oncomplete] (fs.js:254:17)

This image failes: http://cdn.anonfiles.com/1330428503935.jpg This works: http://cdn.anonfiles.com/1330428555739.jpg

Using the example code

var ExifImage = require('exif').ExifImage;

try {
    new ExifImage({ image : 'tiny.jpg' }, function (error, image) {
        if (error)
            console.log('Error: '+error.message);
        else
            console.log(image); // Do something with your data!
    });
} catch (error) {
    console.log('Error: ' + error);
}
Jellyfrog commented 12 years ago

Using the pull request: https://github.com/gomfunkel/node-exif/pull/3 It gives me:

Error: oob
Error: No Exif segment found in the given image

Exiftools gives me a lot of exif-data tho, Lens Manufacturer for example.

gomfunkel commented 11 years ago

I just made some changes that hopefully fix your issue. Could you please try again with the latest version (not on npm yet) and post your results?

gomfunkel commented 11 years ago

As this issue is pretty old and the latest fix doesn't give me any errors with the example files I'm closing it. Please reopen the issue if the problem still exists for you.