Wrapper around exiftool for reading metadata from many different file types.
- supports many different file types
- supports common media types like
png
,jpg
,gif
,mp4
, etc. - extracts metadata such as resolution, author, duration, etc.
- supports gif frame count and duration
- converts metadata keys to camel-case for consistency
This module requires node >= 8
.
brew install exiftool
npm install --save p-exiftool
sudo apt-get update
sudo apt-get install libimage-exiftool-perl
npm install --save p-exiftool
See more details on installing exiftool.
const exiftool = require('p-exiftool')
const metadata = await exiftool('./media/bubbles.gif')
console.log(metadata)
{
"fileName": "bubbles.gif",
"fileSize": 2419689,
"fileType": "GIF",
"fileTypeExtension": "GIF",
"mimeType": "image/gif",
"gifVersion": "89a",
"imageWidth": 360,
"imageHeight": 360,
"hasColorMap": 128,
"colorResolutionDepth": 8,
"bitsPerPixel": 8,
"backgroundColor": 0,
"animationIterations": 0,
"frameCount": 28,
"duration": 1.45,
"imageSize": "360x360"
}
Returns: Promise<Object>
or Promise<Array<Object>>
You may pass multiple files to exiftool, in which case, a Promise for an array of results will be returned. If you only pass a single file, a single object will be returned.
Type: String
Required
Path to one or more image files.
Note that you may also pass extra command-line flags to exiftool
here as well. The default flags are -j -n
.
- exiftool - Underlying binary exiftool itself.
- node-exiftool - Alternate exiftool wrapper.
- simple-exiftool - Alternate exiftool wrapper.
MIT © Travis Fischer
Support my OSS work by following me on twitter