npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

exif

v0.6.0

Published

A node.js library to extract Exif metadata from images.

Downloads

53,216

Readme

node-exif

With node-exif you can extract Exif metadata from images (JPEG). Exif is a format used, for example, by digital cameras and scanners to save additional information about an image in the image file. This information can be the camera model, resolution, where the image was taken (GPS) or when it was taken.

node-exif CLI

Rodrigo Espinosa proposes the npm package exif-cli to execute node-exif from a shell.

Table of Contents

Installation

Installing using npm (node package manager):

npm install exif

If you don't have npm installed or don't want to use it:

cd ~/.node_libraries
git clone git://github.com/gomfunkel/node-exif.git exif

Usage

Easy. Just require node-exif and throw an image at it. If node-exif is able to extract data from the image it does so and returns an object with all the information found, if an error occurs you will receive an error message. To prove that it really is easy please see the following example.

var ExifImage = require('exif').ExifImage;

try {
    new ExifImage({ image : 'myImage.jpg' }, function (error, exifData) {
        if (error)
            console.log('Error: '+error.message);
        else
            console.log(exifData); // Do something with your data!
    });
} catch (error) {
    console.log('Error: ' + error.message);
}

Instead of providing a filename of an image in your filesystem you can also pass a Buffer to ExifImage.

The data returned (exifData in the example above) is an object containing objects for each type of available Exif metadata:

  • image for image information data (IFD0)
  • thumbnail for information regarding a possibly embedded thumbnail (IFD1)
  • exif for Exif-specific attribute information (Exif IFD)
  • gps for GPS information (GPS IFD)
  • interoperability for interoperability information (Interoperability IFD)
  • makernote for vendor specific Exif information (Makernotes)

The ouput for an example image might thus look like this:

{
  image: {
    Make: 'FUJIFILM',
    Model: 'FinePix40i',
    Orientation: 1,
    XResolution: 72,
    YResolution: 72,
    ResolutionUnit: 2,
    Software: 'Digital Camera FinePix40i Ver1.39',
    ModifyDate: '2000:08:04 18:22:57',
    YCbCrPositioning: 2,
    Copyright: '          ',
    ExifOffset: 250
  },
  thumbnail: {
    Compression: 6,
    Orientation: 1,
    XResolution: 72,
    YResolution: 72,
    ResolutionUnit: 2,
    ThumbnailOffset: 1074,
    ThumbnailLength: 8691,
    YCbCrPositioning: 2
  },
  exif: {
    FNumber: 2.8,
    ExposureProgram: 2,
    ISO: 200,
    ExifVersion: <Buffer 30 32 31 30>,
    DateTimeOriginal: '2000:08:04 18:22:57',
    CreateDate: '2000:08:04 18:22:57',
    ComponentsConfiguration: <Buffer 01 02 03 00>,
    CompressedBitsPerPixel: 1.5,
    ShutterSpeedValue: 5.5,
    ApertureValue: 3,
    BrightnessValue: 0.26,
    ExposureCompensation: 0,
    MaxApertureValue: 3,
    MeteringMode: 5,
    Flash: 1,
    FocalLength: 8.7,
    MakerNote: <Buffer 46 55 4a 49 46 49 4c 4d 0c 00 00 00 0f 00 00 00 07 00 04 00 00 00 30 31 33 30 00 10 02 00 08 00 00 00 c6 00 00 00 01 10 03 00 01 00 00 00 03 00 00 00 02 ...>,
    FlashpixVersion: <Buffer 30 31 30 30>,
    ColorSpace: 1,
    ExifImageWidth: 2400,
    ExifImageHeight: 1800,
    InteropOffset: 926,
    FocalPlaneXResolution: 2381,
    FocalPlaneYResolution: 2381,
    FocalPlaneResolutionUnit: 3,
    SensingMethod: 2,
    FileSource: <Buffer 03>,
    SceneType: <Buffer 01>
  },
  gps: {},
  interoperability: {
    InteropIndex: 'R98',
    InteropVersion: <Buffer 30 31 30 30>
  },
  makernote: {
    Version: <Buffer 30 31 33 30>,
    Quality: 'NORMAL ',
    Sharpness: 3,
    WhiteBalance: 0,
    FujiFlashMode: 1,
    FlashExposureComp: 0,
    Macro: 0,
    FocusMode: 0,
    SlowSync: 0,
    AutoBracketing: 0,
    BlurWarning: 0,
    FocusWarning: 0,
    ExposureWarning: 0
  }
}

For more information about the Exif standard please refer to the specification found on http://www.exif.org. A comprehensive list of available Exif attributes and their meaning can be found on http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/.

ToDo / Ideas

There are a lot of things still to be done and to be made better. If you have any special requests please open an issue with a feature request.

License

node-exif is licensed under the MIT License. (See LICENSE)