
Security News
Google’s OSV Fix Just Added 500+ New Advisories — All Thanks to One Small Policy Change
A data handling bug in OSV.dev caused disputed CVEs to disappear from vulnerability feeds until a recent fix restored over 500 advisories.
A lightweight exif image meta-data decipher
Exifer is a small module that read JPEG/TIFF meta-data.
Exif tags/fields are used to encode additional information into images taken by digital still cameras. The exif meta information is organized into different Image File Directories (IFD's) within the image. It contains useful information like image rotation, GPS coordinates, times stamps. ISO, etc.
Learn more about exif tags
This module exposes three module definitions:
dist/exifer.mjs
dist/exifer.umd.js
dist/exifer.js
$ npm install exifer
The script can also be directly included from unpkg.com:
<script src="https://unpkg.com/exifer"></script>
import exifer from 'exifer'
import fs from 'fs';
const buffer = fs.readFileSync('photo.jpg');;
const tags = await exifer(buffer);
// {
// Make: 'Apple',
// Model: 'iPhone X',
// Orientation: 6,
// Software: '12.4',
// ModifyDate: '2019:08:25 15:07:02',
// ... and so on
// }
Returns: object
<Promise>
Takes a JPEG or JIFF image as input and returns an object with extracted meta-data. A Promise
is returned that resolves to an hash-map of tag/value pairs.
Exifer only reads the most essential tags out of the box – which should cover 99% of all use cases. Tags are by default interpreted as ASCII strings.
To read or parse more tags chekcout opts.tags
.
Type: Buffer|ArrayBuffer|File
Example running in the browser reading a File
(ArrayBuffer
):
import exifer from 'exifer';
/**
* Assume 'input' is the value coming from an input field:
* <input type="file" accept="image/*" id="input" >
*/
const input = document.getElementById('#input').files[0];
const tags = await exifer(input);
Example running in node.js reading a JPEG Buffer
:
import exifer from 'exifer';
import fs from 'fs';
const buffer = fs.readFileSync('photo.jpg');;
const tags = await exifer(buffer);
Type: object
Exifer does not extract more than the most essential tags.
You can extract additional tags, or overwrite the default tags, if you want to read more tags or write custom parsers. You can do this by passing tag objects
to either tags.exif
, tags.gps
and/or tags.iptc
.
The key for additional IFD image tags is the IFD field code in hexadecimal notation. The value is a tag object with at least a name
property.
Here's an example where two custom gps tag objects passed as tags.gps
:
import exifer from 'exifer';
import fs from 'fs';
// try to read more GPS tags and parse timestamp
const gps = {
0x0001: {name: 'GPSLatitudeRef'},
0x0007: {name: 'GPSTimeStamp', parse: x => {
return new Date(Date.UTC(1970, 0, 1, x[0], x[1], x[2]));
}}
}
const buffer = fs.readFileSync('photo.jpg');
const parsed = await exifer(buffer, {tags: { gps }});
// {
// ...
// GPSLatitudeRef: 'N',
// GPSTimeStamp: 1970-01-01T19:06:58.000Z
// ...
// }
}
Type: object
default: {}
Hash-map with additonal exif tags.
OBS: Find list of exif tags here
Type: object
default: {}
Hash-map with additonal IPTC tags.
OBS: Find list of IPTC tags here
Type: object
default: {}
Hash-map with additonal GPS tags.
OBS: Find list of exif tags here
If you want to read all tags the following exifer add-on packages have you covered:
To read and parse all exif and tiff tags using add-ons, you simply import and pass them to the corresponding tags option:
import exifer from 'exifer';
import iptc from '@exifer/iptc';
import exif from '@exifer/exif';
import fs from 'fs';
const buffer = fs.readFileSync('photo.jpg');
const parsed = await exifer(buffer, {tags: { exif, iptc }});
Type: boolean
Default: false
Skip exif tags.
Type: boolean
Default: false
Skip IPTC tags.
Type: boolean
Default: false
Skip XMP tags.
Type: Object
Exifer only comes with a few built-in tags. None of the default tag objects have parsers associated with them.
Example with a rather useless parser:
{name: 'ModifyDate', raw: false, parse: x => `date is ${x}`}
Type: String
Required tag name. This is used as the key in the returned result object from exifer.
OBS: name is the only required porperty.
Type: Boolean
Default: false
By default all tags are interpreted as ASCII strings.
Set raw
to true
to get the raw tag value.
Type: Function
Custom parser function. Use this to transform tag values.
Input is a ASCII string unless raw
is true
.
The returned output is used in the final result object returned by exifer.
Inspired by exif-orientation and ExifReader.
MIT © Terkel Gjervig
FAQs
A lightweight Exif image meta-data decipher
The npm package exifer receives a total of 44 weekly downloads. As such, exifer popularity was classified as not popular.
We found that exifer demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
A data handling bug in OSV.dev caused disputed CVEs to disappear from vulnerability feeds until a recent fix restored over 500 advisories.
Research
/Security News
175 malicious npm packages (26k+ downloads) used unpkg CDN to host redirect scripts for a credential-phishing campaign targeting 135+ organizations worldwide.
Security News
Python 3.14 adds template strings, deferred annotations, and subinterpreters, plus free-threaded mode, an experimental JIT, and Sigstore verification.