Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

data: buffer should start with "Exif" #11

Open
stefanocudini opened this issue Nov 20, 2018 · 6 comments
Open

data: buffer should start with "Exif" #11

stefanocudini opened this issue Nov 20, 2018 · 6 comments
Labels

Comments

@stefanocudini
Copy link

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
Copy link

Benibur commented Apr 22, 2019

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
Copy link
Collaborator

lovell commented Sep 25, 2019

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
Copy link

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
Copy link

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

@lovell
Copy link
Collaborator

lovell commented Oct 18, 2020

@WebReflection

  • exif-reader does not depend on sharp. If you need to extract EXIF data as a Buffer from an image then you can use sharp, but other solutions may be available.
  • sharp uses exif-reader to verify it was able to extract valid EXIF data as a Buffer as part of its unit tests and therefore includes it in devDependencies.

@WebReflection
Copy link

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants