Coder Social home page Coder Social logo

jpeg-filename-date-stamper's Introduction

JPEG Filename Date Stamper

This project is a utility to update the EXIF data of JPEG images based on their filenames. It uses the Piexifjs library to manipulate EXIF data.

Features

  • Extracts EXIF data from JPEG files.
  • Updates the DateTimeOriginal and DateTimeDigitized EXIF fields based on the filename.
  • Supports two filename formats for extracting dates:
    • YYYYMMDD_HHMMSS
    • MMDDYYHHMM

Requirements

  • Node.js

Installation

  1. Clone the repository:

    git clone <repository-url>
    cd JPEG-Filename-Date-Stamper
  2. Install the required dependencies:

    npm install
  3. Ensure the following interfaces are available in the ./Interfaces/ directory:

    • EXIF.js
    • FS.js
    • Path.js
    • Piexif.js

Usage

  1. Place your JPEG images in the JPEG-Filename-Date-Stamper/images/ directory.

  2. Run the script:

    node <script-filename>.js

Script Overview

Utility Functions

getBinaryDataFromJpegFile(filename: string): string

Reads the binary data from a JPEG file.

getExifFromJpegFile(filename: string): EXIF

Extracts the EXIF data from a JPEG file.

getJpegFileFromBinaryData(binaryString: string, filename: string): void

Writes binary data to a JPEG file.

chunkArray(array: string[], size: number): string[][]

Splits an array into smaller chunks of the specified size.

getNewTimestamp(filepath: string): string | null

Generates a new timestamp from the filename.

updateImageExifData(imagePath: string): Promise<void>

Updates the EXIF data of a JPEG file with a new timestamp.

Main Function

The main function processes all JPEG files in the specified folder, updating their EXIF data based on their filenames.

Future Additions

  1. Implement a way to select a folder to process.
  2. Implement a GUI for a more user-friendly interaction with the program.
  3. Implement a way to select a date format.

Known Issues

  1. The script currently supports only specific filename formats for extracting dates. More formats might need to be added based on user needs.

jpeg-filename-date-stamper's People

Contributors

joshsj89 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.