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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@substrate-system/exif

v1.0.15

Published

Read and write exif data.

Readme

exif

tests types module semantic versioning Common Changelog install size gzip size license

Read and modify EXIF data in Browsers and Node.

Install

npm i -S @substrate-system/exif

Example

Read EXIF data

import { load } from '@substrate-system/exif'
import { getSummary } from '@substrate-system/exif/summary'

const exif = await load(data)  // Uint8Array of image data

const info = getSummary(exif)

// => {
//   make,
//   model,
//   software,
//   artist,
//   copyright,
//   ...
// }

Remove EXIF data

Just remove all the exif data from an image.

import { stripExif } from '@substrate-system/exif/remove'

const stripped = stripExif(jpeg)

Browsers

Import from the browser-specific entry point for utilities like loadFromBlob and loadFromUrl.

import * as exif from '@substrate-system/exif/browser'

// Or use named imports
import {
  loadFromBlob,
  loadFromUrl,
  ImageIFD,
  ExifIFD
} from '@substrate-system/exif/browser'

Reading from a File Input

Read and update EXIF metadata in a browser.

<input type="file" id="file-input" />
import * as exif from '@substrate-system/exif/browser'

const input = document.getElementById('file-input')
input.addEventListener('change', async (ev) => {
  const file = ev.target.files[0]
  
  // Load EXIF data directly from the File object
  const exifData = await exif.loadFromBlob(file)
  console.log('Camera Make:', exifData['0th'][exif.ImageIFD.Make])
  
  // Modify EXIF data
  exifData['0th'][exif.ImageIFD.Make] = "My Custom Camera"
  
  // Create a new Blob with modified EXIF
  const newBlob = await exif.insertIntoBlob(exif.dumpToBlob(exifData), file)
  
  // Create a download link
  const url = URL.createObjectURL(newBlob)
  console.log('Modified image URL:', url)
})

Reading from a URL

import * as exif from '@substrate-system/exif/browser'

async function logExifFromUrl(url) {
  const exifData = await exif.loadFromUrl(url)
  console.log(exifData)
}

Node.js

Import from the node-specific entry point for filesystem and Buffer helpers.

import * as exif from '@substrate-system/exif/node'

// Or use named imports
import {
  modifyFile,
  loadFromFile,
  ExifIFD,
  GPSIFD
} from '@substrate-system/exif/node'

Reading and Writing Files

The modifyFile helper makes it easy to read, update, and save in one go.

import * as exif from '@substrate-system/exif/node'
import * as ExifIFD from '@substrate-system/exif/tags/exif-ifd'
import * as GPSIFD from '@substrate-system/exif/tags/gps-ifd'

const inputPath = './photo.jpg'
const outputPath = './parsed-photo.jpg'

// Read, modify, and save
exif.modifyFile(inputPath, outputPath, (exifData) => {
  // Add a UserComment
  exifData.Exif[ExifIFD.UserComment] = "Edited with @substrate-system/exif"
  
  // Update GPS Altitude (Rational type: [numerator, denominator])
  exifData.GPS[GPSIFD.GPSAltitude] = [100, 1] 
  
  return exifData
})

Working with Buffers

import * as fs from 'node:fs'
import * as exif from '@substrate-system/exif/node'

const buffer = fs.readFileSync('./photo.jpg')

// Load from Buffer
const exifData = exif.loadFromBuffer(buffer)

// Dump to Buffer
const exifBuffer = exif.dumpToBuffer(exifData)

// Insert into original image buffer
const newImageBuffer = exif.insertIntoBuffer(exifBuffer, buffer)

API

Available as named exports from all entry points.

  • load(data: Uint8Array): Exif Parse EXIF data from a JPEG binary array.
  • dump(exifData: Exif): Uint8Array Convert an EXIF object into a binary array ready for insertion.
  • insert(exifBinary: Uint8Array, jpegData: Uint8Array): Uint8Array Insert an EXIF binary block into a JPEG binary array.

Tag Constants

EXIF tag constants are available as named exports:

  • ImageIFD - Image (0th IFD) tags
  • ExifIFD - Exif sub-IFD tags
  • GPSIFD - GPS sub-IFD tags
  • InteropIFD - Interoperability tags

Example:

import {
  load,
  ImageIFD,
  GPSIFD
} from '@substrate-system/exif'
import * as ExifIFD from '@substrate-system/exif/tags/exif-ifd'
import * as ImageIFD from '@substrate-system/exif/tags/image-ifd'

const exifData = load(jpegBytes)
const cameraMake = exifData['0th'][ImageIFD.Make]
const userComment = exifData.Exif[ExifIFD.UserComment]
const altitude = exifData.GPS[GPSIFD.GPSAltitude]

Helpers

Browser

@substrate-system/exif/browser

  • loadFromBlob(blob: Blob): Promise<Exif>
  • loadFromUrl(url: string): Promise<Exif>
  • dumpToBlob(exifData: Exif): Blob
  • insertIntoBlob(exifBlob: Blob, jpegBlob: Blob): Promise<Blob>
  • removeFromBlob(blob: Blob): Promise<Blob> - Strip EXIF from JPEG, PNG, or WebP

Node JS

@substrate-system/exif/node

  • loadFromFile(path: string): Exif
  • loadFromBuffer(buffer: Buffer): Exif
  • dumpToBuffer(exifData: Exif): Buffer
  • insertIntoBuffer(exifBuffer: Buffer, jpegBuffer: Buffer): Buffer
  • removeFromBuffer(buffer: Buffer): Buffer - Strip EXIF from JPEG, PNG, or WebP
  • modifyFile(input: string, output: string, callback: (data: Exif) => Exif): void

GPS Helper

The GPSHelper export provides utilities for GPS coordinate conversion:

import { GPSHelper } from '@substrate-system/exif'

// Convert decimal degrees to DMS rational format for EXIF
const dmsRational = GPSHelper.degToDmsRational(37.7749)
// Returns: [[37, 1], [46, 1], [2964, 100]]

// Convert DMS rational format back to decimal degrees
const decimal = GPSHelper.dmsRationalToDeg([[37, 1], [46, 1], [2964, 100]], 'N')
// Returns: 37.7749

CLI

This exposes a command line interface.

Show available commands

exif --help

Strip EXIF data

exif strip photo.jpg
exif strip photo.jpg -o photo-clean.jpg

Print EXIF summary as JSON

exif print photo.jpg

Modues

This library uses named exports. You can import what you need:

// Named imports
import {
  load,
  dump,
  insert,
  remove,
  ImageIFD,
  ExifIFD,
  GPSIFD
} from '@substrate-system/exif'

// Or import everything as a namespace
import * as exif from '@substrate-system/exif'