Skip to main content

Getting Started

exiftool-ts is a TypeScript implementation of ExifTool for reading and writing metadata in image files. It provides typed, dependency-free parsing with output verified against the real ExifTool binary; see the parity page for exactly what matches and what doesn't.

Installation

# npm
npm install exiftool-ts

# pnpm
pnpm add exiftool-ts

# yarn
yarn add exiftool-ts

Quick Start

Reading Metadata

import { ExifTool } from '@woss/exiftool';

const exiftool = new ExifTool();
const result = await exiftool.read('photo.jpg');

console.log(result.tags.Make); // "Canon"
console.log(result.tags.Model); // "EOS R5"
console.log(result.tags.DateTimeOriginal); // "2024:01:15 14:30:22"

Writing Metadata

import { ExifTool } from '@woss/exiftool';

const exiftool = new ExifTool();
await exiftool.write('input.jpg', 'output.jpg', {
Title: 'My Photo',
Artist: 'John Doe',
Copyright: '© 2024 John Doe',
});

RAW Images

import { ExifTool } from '@woss/exiftool';

const exiftool = new ExifTool();
const result = await exiftool.read('photo.dng');

console.log(result.format); // "DNG"
console.log(result.tags.Make); // "SONY"
console.log(result.tags.Model); // "ILCE-7RM4"
console.log(result.tags.ImageSize); // "9600x6376"

RAW containers are read-only: TIFF, DNG, CR2, NEF, ARW, ORF, RW2, PEF, ERF, DCR, SRW. MakerNotes are decoded for the core six vendors (Canon, Nikon, Sony, Olympus, Panasonic, Pentax); other vendors keep markers.

CLI Usage

# Basic usage
npx exiftool-ts image.jpg

# JSON output (ExifTool compatible)
npx exiftool-ts -j image.jpg

# Specific tags
npx exiftool-ts -Title -Artist -Copyright image.jpg

# All tags with groups
npx exiftool-ts -G1 -j image.jpg

Next Steps