jpeg-exif

Use for parse .jpg file exif info (including GPS info.).

MIT 20 个版本
安装
npm install jpeg-exif
yarn add jpeg-exif
pnpm add jpeg-exif
bun add jpeg-exif
README

jpeg-exif

Get exif information from jpeg format file. Works with TIFF too!

npm Inline docs Build Status Coverage Status

Async

import exif from "jpeg-exif";

const filePath = "~/Photo/IMG_0001.JPG";

exif.parse(filePath, (err, data) => {
    if (err) {
        console.log(err);
    } else {
        console.log(data);
    }
});

Sync

import exif from "jpeg-exif";

const filePath = "~/Photo/IMG_0001.JPG";
const data = exif.parseSync(filePath);

console.log(data);

From Buffer

import fs from "fs";
import exif from "jpeg-exif";

const filePath = "~/Documents/DOC_0001.TIFF";
const buffer = fs.readFileSync(filePath);
const data = exif.fromBuffer(buffer);

console.log(data);

Features

  • Support All CP3451 Standard Tags (Include GPS & SubExif Tags)
  • Support Sync, Async
  • Support pass Buffer Type

Installation

$ npm i jpeg-exif

Callback Data Format

{
    "Make": "Apple",
    "Model": "Apple",
    //...
    "SubExif": [
        "DateTimeOriginal": "2015:10:06 17:19:36",
        "CreateDate": "2015:10:06 17:19:36",
        //...
    ],
    "GPSInfo":[
        "GPSLatitudeRef": "N",
        "GPSLatitude": [ 35, 39, 40.08 ],
	    //...
    ]
}
版本列表
1.1.4 2019-08-18
1.1.3 2018-11-12
1.1.2 2018-07-19
1.1.1 2018-06-12
1.1.0 2018-06-12
1.0.6 2017-02-20
1.0.5 2016-08-30
1.0.4 2016-08-29
1.0.2 2016-08-29
1.0.1 2016-08-29
1.0.0 2016-08-23
0.0.9 2016-06-30
0.0.8 2016-03-29
0.0.7 2016-03-23
0.0.6 2016-03-22
0.0.5 2015-11-11
0.0.4 2015-11-10
0.0.3 2015-11-10
0.0.2 2015-11-10
0.0.1 2015-11-10