2

Trying to find a way to extract IPTC data from an image file buffer, there are existing libraries available on npm that allow you to open and read a file from the local filesystem but i am storing files on AWS S3 and would prefer to use buffers instead of creating unnecessary disk writes.

Not sure where to start, maybe start looking through how this module works: https://www.npmjs.com/package/extract-iptc And create my own module? Or is there an easier way that i've missed?

Cade Embery
  • 433
  • 1
  • 5
  • 18

2 Answers2

0

I was able to extract IPTC data by using

var iptc = require('node-iptc');
var iptc_data = iptc(imageData);
Cade Embery
  • 433
  • 1
  • 5
  • 18
0

Also there's an isomorphic library exifr that works in both Node.js and browser. And it works with the new HEIC image format as well.

exifr.parse(input, {iptc: true}).then(output => {
  console.log('IPTC', output)
})

It parses multiple formats (TIFF/EXIF, ICC, IPTC, XMP, JFIF) but IPTC isn't enabled by default so you need to enabled it in options as seen in the example.

Mike Kovařík
  • 244
  • 2
  • 8