devongovett / exif-reader

A small EXIF image metadata reader
MIT License
145 stars 22 forks source link

data: buffer should start with "Exif" #11

Open stefanocudini opened 5 years ago

stefanocudini commented 5 years ago

trying to read a buffer created using: var exifreader = Npm.require('exif-reader');

var buf = Buffer.from(fileObj.blob, 'binary'); var meta = exifreader(buf);

Benibur commented 5 years ago

the same for me, I tried another lib that worked and also expected a buffer => the problem is in the lib I guess. here is a photo failing : SAM_2127_d47a

lovell commented 4 years ago

Hello, the EXIF data must be extracted from the JPEG image first.

For the image above try something like:

const sharp = require('sharp');
const exifReader = require('exif-reader');

sharp('56497304-40e89a80-64fd-11e9-9684-ee95b5d58567.JPG')
  .metadata()
  .then(({ exif }) => {
    const exifProperties = exifReader(exif);
    console.log(exifProperties);
  });

which outputs:

{ image:
   { Make: 'SAMSUNG',
     Model: 'SAMSUNG PL20,PL21 / VLUU PL20,PL21 ',
     Orientation: 1,
     XResolution: 96,
     YResolution: 96,
     ResolutionUnit: 2,
     Software: 'Microsoft Windows Photo Viewer 6.1.7600.16385',
     ModifyDate: 2019-01-14T11:31:13.000Z,
     YCbCrPositioning: 2,
     Copyright: 'COPYRIGHT, 2011',
     ExifOffset: 2360,
     ...
jamesdixon commented 4 years ago

This bit me as well.

@lovell I believe it would make a lot of sense to include this functionality by default as the other libraries do as it's the standard use case for most.

Thoughts?

WebReflection commented 3 years ago

So, sharp depends on this module and this module requires sharp to work? That's a bit bizarre, imho.

lovell commented 3 years ago

@WebReflection

WebReflection commented 3 years ago

@lovell thanks for clarifying that, I ended up using both sharp and exiftool a part, as it seems to be the standard. I might have a second look at this module though, since it works fine via sharp metadata.