The Tags
interface in exiftool-vendored represents the massive world of image and video metadata. The core Tags.ts
file is an auto-generated TypeScript file defining thousands of metadata fields that can be extracted from photos and videos.
Tags are metadata fields embedded in image and video files. They contain information like:
Each tag in the TypeScript interface includes semantic JSDoc annotations:
/**
* @frequency 🔥 ★★★★ (85%)
* @groups EXIF, MakerNotes
* @example 100
*/
ISO?: number;
/**
* @frequency 🧊 ★★★☆ (23%)
* @groups MakerNotes
* @example "Custom lens data"
*/
LensSpec?: string;
These annotations provide:
The Tags
interface combines multiple tag categories:
export interface Tags
extends FileTags, // File system info (size, dates, permissions)
EXIFTags, // Camera settings (ISO, aperture, etc.)
GPSTags, // Location data
IPTCTags, // Descriptive metadata
XMPTags, // Adobe metadata standard
MakerNotesTags, // Camera manufacturer specific
CompositeTags, // Calculated/derived values
ExifToolTags {
// ExifTool-specific fields
// ... combined interface
}
The Tags
interface is automatically generated by the mktags.ts
script, which:
Source images come from:
The mktags
script also generates data/TagMetadata.json
, which provides programmatic access to tag metadata in the format:
Record<
string,
{
frequency: number; // 0-1 decimal: percentage of sample files containing this tag
mainstream: boolean; // true if tag is from mainstream consumer devices (iPhone, popular Canon/Nikon/Sony)
groups: string[]; // sorted array of metadata groups where this tag appears (e.g., ["EXIF", "MakerNotes"])
}
>;
This allows developers to programmatically access the same frequency and device compatibility information shown in the JSDoc annotations, plus metadata group information for understanding where tags originate (EXIF, XMP, MakerNotes, etc.).
The Tags
interface does not include every possible metadata field.
This is by design due to TypeScript limitations:
Just because a field isn't in the Tags
interface doesn't mean it won't be in your data.
const tags = await exiftool.read("photo.jpg");
// These are typed and autocomplete:
console.log(tags.Make); // "Canon"
console.log(tags.Model); // "EOS R5"
// This field might exist but isn't typed:
if ("CustomCameraField" in tags) {
// do something interesting with tags.CustomCameraField
}
With thousands of possible fields, how do you find what you need?
Focus on 4-star tags first - they're found in most files:
Make
, Model
- Camera identificationImageWidth
, ImageHeight
- DimensionsDateTime
, DateTimeOriginal
- TimestampsMIMEType
- File formatTypeScript provides excellent autocomplete for tag names:
const tags = await exiftool.read("photo.jpg");
tags. // <-- IDE shows all available tags with descriptions
Visit the online API docs to browse all available tags with examples.
Refer to the excellent ExifTool documentation. Start with the EXIF, IPTC, and XMP groups -- those are the most common.
Different use cases need different tags:
DateTime*
, Make
, Model
, GPS*
ImageWidth
, ImageHeight
, XResolution
, YResolution
Copyright
, Artist
, Rights*
ISO
, FNumber
, ExposureTime
, WhiteBalance
Tags have proper TypeScript types:
const tags = await exiftool.read("photo.jpg");
// Number fields
const width: number | undefined = tags.ImageWidth;
const iso: number | undefined = tags.ISO;
// String fields
const make: string | undefined = tags.Make;
const mimeType: string | undefined = tags.MIMEType;
// Date fields (special classes)
const created: ExifDateTime | string | undefined = tags.DateTimeOriginal;
Most tags are optional (?
) since not all files contain all metadata:
const tags = await exiftool.read("photo.jpg");
// Safe checking
if (tags.Make) {
console.log(`Camera: ${tags.Make}`);
}
// With defaults
const make = tags.Make ?? "Unknown";
const width = tags.ImageWidth ?? 0;
// Nullish coalescing for fallbacks
const timestamp = tags.DateTimeOriginal ?? tags.DateTime ?? tags.FileModifyDate;
Check for parsing errors and warnings in the returned Tags
object:
// const tags = await exiftool.read("photo.jpg");p
if (tags.errors && tags.errors.length > 0) {
console.warn("Metadata parsing issues:", tags.errors);
}