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

exif-pilot

v1.0.3

Published

Exif Pilot makes it easy to read, add, and update EXIF metadata in images with a simple and flexible API.

Downloads

257

Readme

Exif-Pilot

Exif Pilot makes it easy to read, add, and update EXIF metadata in images with a simple and flexible API.

Features

  • Read EXIF metadata from popular image formats (e.g., JPEG, PNG).
  • Add new EXIF tags to images.
  • Update existing EXIF metadata.
  • Lightweight and easy-to-use API.

Installation

Install ExifPilot via NPM:

npm install exif-pilot

Usage

1. Reading EXIF Metadata

Use ExifPilot to extract EXIF metadata from an image file.

const exifPilot = require("exif-pilot");

// Load an image file
const exifData = await exifPilot.read("path/to/image.jpg");

console.log(exifData);

2. Adding EXIF Metadata

Add new EXIF metadata to an image file.

const exifPilot = require("exif-pilot");

await exifPilot.write("path/to/image.jpg", {
  Artist: "John Doe",
  Copyright: "2024 John Doe",
});

3. Updating EXIF Metadata

Modify existing EXIF metadata.

const exifPilot = require("exif-pilot");

await exifPilot.write("path/to/image.jpg", {
  Artist: "Jane Doe",
  DateTimeOriginal: "2024:09:01 12:34:56",
});

4. Strip EXIF Metadata

Remove existing EXIF metadata.

const exifPilot = require("exif-pilot");

const tagsToKeep = ["Artist"];
await exifPilot.strip("path/to/image.jpg", {
  retain: tagsToKeep,
});

5. Delete EXIF Tags

To delete a tag, use null as the value.

const exifPilot = require("exif-pilot");

await exifPilot.write("path/to/image.jpg", {
  UserComment: null,
});

API

read(filePath)

  • Description: Reads the metadata from the specified image file.
  • Parameters:
    • filePath (string): The path to the image file.
  • Returns: A promise that resolves with the file metadata as a JavaScript object.
  • Example:
    const exifData = await exifPilot.read("path/to/image.jpg");
    console.log(exifData);
    write(filePath, metadata);

write(filePath, metadata)

  • Description: Writes metadata to the specified image file.

  • Parameters:

    • filePath (string): The path to the image file.
    • metadata (object): The EXIF metadata to be written. You can pass specific tags, such as AllDates, which will write to the common EXIF date/time tags like DateTimeOriginal, CreateDate, and ModifyDate.
  • Returns: A promise that resolves with the write operation result, which includes the number of files created, updated, and any warnings.

  • Example:

    const result = await exifPilot.write("path/to/image.jpg", {
      Artist: "John Doe",
      AllDates: "2024:09:02 12:34:56",
    });
    console.log(result);

    strip(filePath, retain = [])

  • Description: Writes metadata to the specified image file.

  • Parameters:

    • filePath (string): The path to the image file.
    • retain (string[]): An optional array of tags to retain in the file.
  • Returns: A promise that resolves with the write operation result, indicating the changes made to the file.

  • Example:

    const result = await exifPilot.strip("path/to/image.jpg", ["Artist"]);
    console.log(result);

    end()

  • Description: Shuts down the underlying EXIF tool process. After calling this, no further operations can be performed until the tool is restarted.

  • Parameters: None

  • Returns: A promise that resolves once the tool has been shut down.

  • Example:

    await exifPilot.end();

    restart()

  • Description: Restarts the EXIF tool with the previously passed options. This can be used to restart the tool after it has been shut down.

  • Parameters: None

  • Returns: A promise that resolves once the tool has been restarted.

  • Example:

    await exifPilot.restart();

Supported Formats

Image Formats

  • JPEG
  • TIFF
  • PNG
  • GIF
  • BMP
  • RAW formats (CR2, NEF, ARW, etc.)

Video Formats

  • MP4
  • AVI
  • MOV
  • MKV

Audio Formats

  • MP3
  • WAV
  • FLAC
  • AAC

Document Formats

  • PDF
  • DOCX
  • XLSX
  • RTF

Other Formats

  • HTML
  • XML
  • EPUB
  • ZIP

Metadata Types

  • EXIF: Exchangeable Image File Format
  • IPTC: International Press Telecommunications Council
  • XMP: Extensible Metadata Platform
  • MakerNotes: Camera-specific metadata

For more detailed information on supported tags and formats, refer to the official ExifTool documentation.

Contributing

Contributions are welcome! Please submit a pull request or open an issue to discuss your ideas or report bugs.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Acknowledgments

Exif Pilot is built to make working with EXIF metadata as seamless as possible. If you find this library helpful, please consider contributing or starring the repository!