Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/shinnn/get-exif
Get Exif data from JPEG
https://github.com/shinnn/get-exif
buffer exif image javascript jpeg metadata nodejs photos
Last synced: 26 days ago
JSON representation
Get Exif data from JPEG
- Host: GitHub
- URL: https://github.com/shinnn/get-exif
- Owner: shinnn
- License: isc
- Created: 2018-06-29T05:01:34.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-06-12T23:45:58.000Z (over 5 years ago)
- Last Synced: 2024-09-15T22:53:04.842Z (about 2 months ago)
- Topics: buffer, exif, image, javascript, jpeg, metadata, nodejs, photos
- Language: JavaScript
- Homepage:
- Size: 123 KB
- Stars: 5
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# get-exif
[![npm version](https://img.shields.io/npm/v/get-exif.svg)](https://www.npmjs.com/package/get-exif)
[![Github Actions](https://action-badges.now.sh/shinnn/get-exif)](https://wdp9fww0r9.execute-api.us-west-2.amazonaws.com/production/results/shinnn/get-exif)
[![codecov](https://codecov.io/gh/shinnn/get-exif/branch/master/graph/badge.svg)](https://codecov.io/gh/shinnn/get-exif)A [Node.js](https://nodejs.org/) module to get Exif data from JPEG data
```javascript
const {readFile} = require('fs').promises;
const getExif = require('exif');(async () => {
const exif = getExif(await readFile('example.jpg')).Exif;// 33434: ID of the `ExposureTime` tag
exif['33434']; //=> [1, 100]// 36867: ID of the `DateTimeOriginal` tag
exif['36867']; //=> '2017:11:19 08:47:19'
})();
```## Installation
[Use](https://docs.npmjs.com/cli/install) [npm](https://docs.npmjs.com/about-npm/).
```
npm install get-exif
```## API
```javascript
const getExif = require('get-exif');
```### getExif(*data*)
*data*: `Buffer | string` (data of a [JPEG](https://jpeg.org/jpeg/) file)
Return: `Object`It reads Exif data from a `Buffer` using [Piexifjs](https://github.com/hMatoba/piexifjs) and return it as an `Object`.
```javascript
imageBuffer; //=>getExif(imageBuffer); /*=> {
'0th': { ... },
'1st': { ... },
Exif: { ... },
GPS: { ... }
Interop: { ... },
thumbnail: ' ... '
} */
```It also accepts a [`Buffer`-to-`latin1` encoded string](https://nodejs.org/api/buffer.html#buffer_buf_tostring_encoding_start_end).
```javascript
imageString; //=> 'ÿØÿáAExif\u0000\u0000II*\u0000\b\u0000 ...'getExif(imageString);
```## Related
* [read-exif](https://github.com/shinnn/read-exif) — Get Exif data from a file instead of a `Buffer` or `string`
## License
[ISC License](./LICENSE) © 2018 - 2019 Watanabe Shinnosuke