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

@metadata/exif

v1.0.0

Published

[fork exif-js] Reads Files Metadata In The Browser And Node.JS. Optimised With Google Closure Compiler, BugFixes And New Features.

Downloads

119

Readme

@metadata/exif

npm version

@metadata/exif is fork of JavaScript Library For Reading EXIF Image Metadata. It Reads Files Metadata In The Browser. The package has been optimised with Google Closure Compiler.

The differences to the original package is that at the moment, only the handleBinaryFile method is implemented. There are also some bug-fixes and features, including the options to parse dates into Date object, the coordinates format specification option, and correct parsing of UTF-8 data which was wrong in the origin. The XMP support has been removed for a near future. IPTC tags will have names consistent with exiftool.

yarn add -E @metadata/exif

Table Of Contents

Usage

There are 3 ways to use the package:

  1. As an ES6 module, because the module field of the package.json file is set to src/index.js which exports a ES6 module.
  2. As a CommonJS module, because the main field of the package.json file is set to build/index.js which is the same as the module, but where the import/export statements have been transpiled into module.exports and require.
  3. As a browser bundle, compiled with GCC that sets the window.EXIF object to the package API. To do that, grab the file from the dist folder and add it to the page.

API

During development, the package is available by importing its named functions:

import { handleBinaryData } from '@metadata/exif'

handleBinaryData(  binFile: ArrayBuffer,  config?: HandleBinaryFile,): { data, iptcdata }

Extract metadata from the ArrayBuffer.

Cat

import { inspect } from 'util'
import { readBuffer } from '@wrote/read'
import { handleBinaryFile } from '@metadata/exif'

(async () => {
  const { buffer: photo } = (await readBuffer('test/fixture/images/photo.jpg'))
  const res = handleBinaryFile(photo, {
    parseDates: true,
    coordinates: 'dms',
  })
  console.log(inspect(res, null, 100))
})()
{ data: 
   { Make: 'Canon',
     Model: 'Canon EOS 400D DIGITAL',
     Orientation: 1,
     XResolution: { [Number: 72] numerator: 72, denominator: 1 },
     YResolution: { [Number: 72] numerator: 72, denominator: 1 },
     ResolutionUnit: 2,
     DateTime: 2015-06-20T20:10:14.000Z,
     Copyright: 'î† ∂éçø',
     ExifIFDPointer: 218,
     GPSInfoIFDPointer: 648,
     ExposureTime: { [Number: 0.04] numerator: 1, denominator: 25 },
     FNumber: { [Number: 1.6] numerator: 8, denominator: 5 },
     ExposureProgram: 'Aperture priority',
     ISOSpeedRatings: 200,
     ExifVersion: '0221',
     DateTimeOriginal: 2015-06-20T20:10:14.000Z,
     DateTimeDigitized: 2015-06-20T20:10:14.000Z,
     ComponentsConfiguration: 'YCbCr',
     ShutterSpeedValue: 4.64385986328125,
     ApertureValue: { [Number: 1.35614013671875] numerator: 22219, denominator: 16384 },
     ExposureBias: 0,
     MaxApertureValue: { [Number: 1.3989796723380756] numerator: 53199, denominator: 38027 },
     MeteringMode: 'Pattern',
     Flash: 'Flash did not fire, compulsory flash mode',
     FocalLength: { [Number: 50] numerator: 50, denominator: 1 },
     FlashpixVersion: '0100',
     ColorSpace: 1,
     PixelXDimension: 250,
     PixelYDimension: 167,
     FocalPlaneXResolution: { [Number: 3210.94640682095] numerator: 2636187, denominator: 821 },
     FocalPlaneYResolution: { [Number: 3230.2405498281787] numerator: 940000, denominator: 291 },
     FocalPlaneResolutionUnit: 2,
     CustomRendered: 'Normal process',
     ExposureMode: 0,
     WhiteBalance: 'Auto white balance',
     SceneCaptureType: 'Standard',
     GPSVersionID: '2.3.0.0',
     GPSLatitudeRef: 'N',
     GPSLatitude: 
      [ { [Number: 40] numerator: 40, denominator: 1 },
        { [Number: 15] numerator: 15, denominator: 1 },
        { [Number: 3.2471999364524584] numerator: 40879, denominator: 12589 } ],
     GPSLongitudeRef: 'W',
     GPSLongitude: 
      [ { [Number: 75] numerator: 75, denominator: 1 },
        { [Number: 7] numerator: 7, denominator: 1 },
        { [Number: 57.5688] numerator: 71961, denominator: 1250 } ],
     thumbnail: {} },
  iptcdata: 
   { Category: 'ANI',
     'Caption-Abstract': 'A black cat looking into the camera.',
     Keywords: [ 'Animal', 'Cat', 'Pet' ],
     Credit: 'Art Deco',
     DateCreated: '20150620',
     'By-lineTitle': [ 'Photographer', 'Owner' ],
     'Writer-Editor': [ 'Art', 'Deco' ],
     Headline: 'Black Cat',
     CopyrightNotice: '© î† ∂éçø 2019, All rights reserved.',
     'By-line': [ 'Anton', 'His Friend' ] } }

_exif.HandleBinaryFile: Options for the handleBinaryFile method.

| Name | Type | Description | Default | | ----------- | ---------------- | --------------------------------------------------------------------------------------------------------------------- | ------- | | parseDates | boolean | Parse EXIF dates into JS dates. | false | | coordinates | string | Return coordinates either as DMS (degrees, minutes, seconds) or DD (decimal degrees). Specified as 'dms' or 'dd'. | dms |

Copyright

(c) Demimonde 2019