Security News
PyPI’s New Archival Feature Closes a Major Security Gap
PyPI now allows maintainers to archive projects, improving security and helping users make informed decisions about their dependencies.
exifreader
Advanced tools
ExifReader is a JavaScript library that parses image files and extracts the metadata. It can be used either in a browser or from Node. Supports JPEG files with tags encoded using Exif, IPTC, and XMP.
ExifReader supports module formats AMD, CommonJS and globals and can therefore easily be used from Webpack, RequireJS, Browserify, Node etc. Since it is written using ES2015, you can also import the ES2015 module directly from your own ES2015 project.
Easiest is through npm or Bower:
npm install exifreader --save
bower install exifreader --save
If you want to clone the git repository instead:
git clone git@github.com:mattiasw/ExifReader.git
cd ExifReader
npm install
After that, the transpiled, concatenated and minified ES5 file will be in the
dist
folder together with a sourcemap file.
ES modules:
import ExifReader from 'exifreader';
CommonJS/Node modules:
const ExifReader = require('exifreader');
script
tag:
<script src="/path/to/exif-reader.js"></script>
const tags = ExifReader.load(fileBuffer);
const imageDate = tags['DateTimeOriginal'].description;
const unprocessedTagValue = tags['DateTimeOriginal'].value;
By default, Exif, IPTC and XMP tags are grouped together. This means that if
e.g. Orientation
exists in both Exif and XMP, the first value (Exif) will be
overwritten by the second (XMP). If you need to separate between these values,
pass in an options object with the property expanded
set to true
:
const tags = ExifReader.load(fileBuffer, {expanded: true});
Some XMP tags have processed values as descriptions. That means that e.g. an
Orientation
value of 3
will have Rotate 180
in the description
property.
If you would like more XMP tags to have a processed description, please file an
issue or do a pull request.
The library makes use of the DataView API which is supported in Chrome 9+, Firefox 15+, Internet Explorer 10+, Edge, Safari 5.1+, Opera 12.1+. If you want to support a browser or Node.js that doesn't have DataView support, you should probably use a polyfill like jDataView.
A full HTML example page is located in the examples/html/ directory. The example uses the FileReader API which is supported by the latest versions of all the major browsers.
Also, there is a Node.js example in the examples/nodejs/ directory that uses jDataView to polyfill the DataView API.
Testing is done with Mocha and Chai. Run with:
npm test
ExifReader uses the Mozilla Public License 2.0 (MPL-2.0). In short that means you can use this library in your project (open- or closed-source) as long as you mention the use of ExifReader and make any changes to ExifReader code available if you would to distribute your project. But please read the full license text to make sure your specific case is covered.
FAQs
Library that parses Exif metadata in images.
The npm package exifreader receives a total of 39,093 weekly downloads. As such, exifreader popularity was classified as popular.
We found that exifreader demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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
PyPI now allows maintainers to archive projects, improving security and helping users make informed decisions about their dependencies.
Research
Security News
Malicious npm package postcss-optimizer delivers BeaverTail malware, targeting developer systems; similarities to past campaigns suggest a North Korean connection.
Security News
CISA's KEV data is now on GitHub, offering easier access, API integration, commit history tracking, and automated updates for security teams and researchers.