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 🙏

© 2026 – Pkg Stats / Ryan Hefner

astro-image-exif-loader

v0.2.4

Published

Astro content collection loader for extracting EXIF data from images

Readme

Astro Image EXIF Loader

An Astro content collection loader that extracts EXIF metadata from images using exiftool-vendored.

What it does

This package provides two main functions:

  1. Loader: Creates an Astro content collection from your images and extracts EXIF metadata into structured data. Each entry's id is the filename with extension (e.g., "photo.jpg").
  2. Importer: Optionally enhances collection entries with Astro Assets imports so you can display the actual images. Only works for images under /src/.

The loader scans your image directory and creates collection entries with EXIF data. Use getEntry("collection", "filename.jpg") to get specific images by filename.

Quick Start

1. Create a content collection with EXIF data

Configure your collection in src/content.config.ts:

import { defineCollection } from "astro:content";
import { defineExifCollection } from "astro-image-exif-loader";

const images = defineCollection(
  defineExifCollection({
    imagesDir: { pattern: "**/*", base: "src/content/images" },
    presets: ["basic", "location"], // or use `tags` for specific fields
  }),
);

export const collections = { images };

2. Use the data in your pages

Option A: Just EXIF data (no image display)

---
import { getCollection } from 'astro:content';

const images = await getCollection('images');
---

{images.map(image => (
  <div>
    <h3>{image.data.fileName}</h3>
    <p>Camera: {image.data.Make} {image.data.Model}</p>
    <p>ISO: {image.data.ISO}</p>
  </div>
))}

Option B: EXIF data + actual images

---
import { getCollection } from 'astro:content';
import { Image } from 'astro:assets';
import imageImporter from 'astro-image-exif-loader/importer';

const images = await imageImporter(await getCollection('images'));
---

{images.map(image => (
  <div>
    {image.defaultImport && <Image src={image.defaultImport} alt="" width={400} />}
    <p>Camera: {image.data.Make} {image.data.Model}</p>
    <p>ISO: {image.data.ISO}</p>
  </div>
))}

Image Patterns

Configure where your images are located:

defineExifCollection({
  imagesDir: {
    pattern: "**/*.{jpg,jpeg,png,tiff}",
    base: "src/content/photos",
  },
});

Pattern Restrictions

For the Loader (EXIF extraction): No restrictions - any valid glob pattern works

For the Importer (Astro Assets): Must be under /src/ due to Vite limitations

defineExifCollection(options)

Creates a complete collection definition with both loader and schema.

Options:

  • imagesDir.pattern: Glob pattern for matching images (default: '**/*')
  • imagesDir.base: Base directory path (default: 'src/content/images')
  • presets: Array of preset groups to extract
  • tags: Array of specific EXIF tag names to extract
  • excludeTags: Array of EXIF tag names to exclude from presets/tags
  • extractAll: Boolean to extract all available EXIF data
  • includeRawExif: Boolean to include raw EXIF object (default: false)

You can combine presets and tags together. Use excludeTags to remove specific tags from presets:

defineExifCollection({
  presets: ["camera", "exposure"],
  tags: ["GPSAltitude"],
  excludeTags: ["Make"],
});

Available Preset Tags

basic:

  • FileSize
  • ImageWidth
  • ImageHeight

camera:

  • Make, Model
  • LensModel, Lens, LensID, LensInfo
  • LensSerialNumber, SerialNumber, BodySerialNumber, CameraSerialNumber
  • LensMake, MaxAperture, MinFocalLength, MaxFocalLength

exposure:

  • ISO, FNumber
  • ExposureTime, ShutterSpeed
  • FocalLength, FocalLengthIn35mmFormat
  • Flash, WhiteBalance, ExposureMode, MeteringMode

datetime:

  • DateTimeOriginal, CreateDate, DateTime

location:

  • GPSLatitude, GPSLongitude, GPSAltitude
  • Country, State, City, Location, Sub-location
  • GPSAreaInformation, Country-PrimaryLocationCode, Province-State

technical:

  • ColorSpace, Orientation, Software
  • SceneType, SceneCaptureType

metadata:

  • Artist, Copyright, ImageDescription
  • Keywords, Title, Subject