Have you ever clicked pictures from a digital camera, just to realize later that the date & time were not set correctly?
Or have you moved your photos countless times across different devices and storage systems, which has corrupted the EXIF data, and now all your photos show today's date instead of when they were actually taken?
With hundreds or thousands of photos, manually changing the date and time of each photo is a nightmare that can take days or weeks of tedious work.
This tool will save you from that hell.
The Image Metadata Editor is a powerful command-line tool that intelligently processes your photo collections, preserving the relative timing between images while correcting their metadata timestamps. Whether your photos have corrupted EXIF data, incorrect camera dates, or missing timestamps entirely, this tool can fix them all in minutes, not days.
- Fixes corrupted EXIF data from older digital cameras and file transfers
- Preserves time relationships between photos while updating dates
- Bulk processes entire folders of images efficiently
- Extracts dates from filenames automatically (e.g.,
IMG_20241031_143052.jpg) - Handles time corrections for camera clock drift (Β±seconds to hours)
- Prepares photos for Google Photos and other cloud services
Before using this tool, you need to install the following dependencies:
ExifTool is required for reading and writing image metadata.
macOS:
brew install exiftoolUbuntu/Debian:
sudo apt-get update
sudo apt-get install libimage-exiftool-perlWindows: Download from exiftool.org and add to your PATH.
This tool is written in Go, so you need Go installed to build it.
Installation:
- Download from golang.org
- Follow the installation instructions for your operating system
- Verify installation:
go version
- Clone or download this repository:
git clone https://github.com/whonehuljain/metadata-editor.git
cd metadata-editor- Build the tool:
go mod tidy
go build -o image-metadata-editor ./cmd- Verify installation:
./image-metadata-editor --helpTest with dry-run (recommended first step):
./image-metadata-editor -folder /path/to/photos -sequential -date 2024-10-31 -start-time 15:30:00 -dry-run -verboseProcess photos from a vacation folder:
./image-metadata-editor -folder ./vacation-photos -sequential -date 2024-07-15 -start-time 09:00:00 -verboseExtract dates from filenames automatically:
./image-metadata-editor -folder ./camera-dump -auto -verboseCorrect camera time that was 2 minutes fast:
./image-metadata-editor -folder ./photos -sequential -date 2024-10-31 -start-time 14:00:00 -offset -2m -verboseHandle different filename formats:
./image-metadata-editor -folder ./photos -auto -format "2006-01-02_15-04-05" -verboseSet same timestamp for all photos:
./image-metadata-editor -folder ./group-photos -date 2024-10-31 -time 18:30:00 -verboseThe tool offers three distinct modes to handle different scenarios:
What it does: Automatically extracts date and time from image filenames.
Best for:
- Photos from smartphones with timestamp filenames
- Screenshots with date stamps
- Camera files with embedded dates
Supported filename patterns:
IMG_20241031_143052.jpgβ October 31, 2024 at 2:30:52 PM20241031_143052.jpgβ October 31, 2024 at 2:30:52 PM2024-10-31_14-30-52.jpgβ October 31, 2024 at 2:30:52 PM
Example:
./image-metadata-editor -folder ./smartphone-photos -auto -verboseWhat it does: Sets all photos to a specific date while preserving the original time differences between them.
Best for:
- Camera photos where the date was wrong but the timing sequence is correct
- Vacation photos that need to be moved to the correct date
- Event photos with systematic time errors
How it works:
- Reads original timestamps from all photos
- Calculates time differences between photos
- Applies the same differences to your new base date/time
Example scenario: Your camera photos were taken at:
- Photo 1: 5:30:15 AM
- Photo 2: 5:32:30 AM
- Photo 3: 5:35:45 AM
With base time 3:00:00 PM, they become:
- Photo 1: 3:00:00 PM
- Photo 2: 3:02:15 PM
- Photo 3: 3:05:30 PM
Example:
./image-metadata-editor -folder ./camera-photos -sequential -date 2024-10-31 -start-time 15:00:00 -verboseWhat it does: Sets the exact same date and time for all photos in the folder.
Best for:
- Group photos taken at the same event
- Scanned photos from a specific date
- Photos where exact timing doesn't matter
Example:
./image-metadata-editor -folder ./group-photos -date 2024-10-31 -time 18:00:00 -verboseCompensates for camera clock errors or timezone differences.
Supported formats:
+30sor-30s(seconds)+2m30sor-2m30s(minutes and seconds)+1h30mor-1h30m(hours and minutes)+1h5m30sor-1h5m30s(full format)
Examples:
# Camera was 30 seconds slow
./image-metadata-editor -folder ./photos -sequential -date 2024-10-31 -start-time 15:00:00 -offset +30s
# Camera was 2 hours fast (wrong timezone)
./image-metadata-editor -folder ./photos -auto -offset -2hSpecify custom patterns for filename date extraction.
Default format: 20060102_150405 (YYYYMMDD_HHMMSS)
Custom examples:
# For format: 2024-10-31_14-30-52
./image-metadata-editor -folder ./photos -auto -format "2006-01-02_15-04-05"
# For format: 31Oct2024_143052
./image-metadata-editor -folder ./photos -auto -format "02Jan2006_150405"Preview changes without actually modifying files.
./image-metadata-editor -folder ./photos -sequential -date 2024-10-31 -start-time 15:00:00 -dry-run -verboseGet detailed information about the processing steps.
- JPEG/JPG: Full EXIF metadata support with corruption repair
- PNG: Basic metadata support
- TIFF: Complete metadata handling
- Backup your photos before running the tool (though it doesn't delete original data)
- Test with
-dry-runfirst to verify the results - Use
-verboseto understand what the tool is doing - The tool fixes corrupted EXIF data automatically during processing
- Google Photos compatibility: Updated metadata works perfectly with cloud photo services
ExifTool not found:
# Verify ExifTool installation
exiftool -ver
# If not installed, install it:
brew install exiftool # macOS
sudo apt-get install libimage-exiftool-perl # UbuntuNo dates extracted from filenames:
- Check your filename format with
-verbose - Use custom format with
-formatparameter - Consider using sequential mode instead
Corrupted EXIF data:
- The tool automatically fixes most corruption issues
- Use
-verboseto see repair progress - Some very damaged files may need manual inspection
# Camera date was wrong, but photo sequence timing is correct
./image-metadata-editor -folder ./DCIM/Camera -sequential -date 2024-10-31 -start-time 09:00:00 -verbose# Smartphone photos with timestamps in filenames
./image-metadata-editor -folder ./phone-backup -auto -verbose# All scanned photos from same event
./image-metadata-editor -folder ./scanned-1995-birthday -date 1995-06-15 -time 16:00:00 -verbose# Camera was 1 hour 30 minutes fast
./image-metadata-editor -folder ./photos -auto -offset -1h30m -verboseMade with β€οΈ to save you from metadata hell