image-date-fixer is a command-line tool written in Rust for restoring missing exif data from the filepath.
This can be very useful for tagging photos received from friends or family, or for photos from legacy devices that do not support or strip exif data.
⚠️ Warning: Always back up your files before running any script that modifies them. Test the script with the--dry-runoption first to ensure it behaves as expected.
- Extracts date information from filenames of various formats, including:
- Android-style (
IMG_YYYYMMDD_HHMMSS.jpg) - Standard date-prefixed (
YYYY-MM-DD_HHMMSS.jpg) - Screenshot-style (
Screenshot_YYYYMMDD-HHMMSS.jpg) - Unix timestamp-prefixed filenames
- UUID timestamp-prefixed filenames
- WhatsApp-style (
IMG-YYYYMMDD-WAXXXX.jpg)
- Android-style (
- Respects existing EXIF metadata if available
- Corrects invalid file modification dates
- Supports recursive processing of directories
- Can exclude specific directories from processing
- Dry-run mode for testing without modifying files
- Use
--helpto see all available options
Make sure to add ~/.cargo/bin to your PATH.
cargo install image-date-fixer
image-date-fixer --ignore-minor-exif-errors --fix-future-modified-times 2 --fix-future-exif-dates 2 --files /my_folder_with_images --exclude-files /my_folder_with_images/ignored --dry-rungit clone <this repo>
cd image-date-fixer
cargo build --release
./target/release/image-date-fixer --ignore-minor-exif-errors --fix-future-modified-times 2 --fix-future-exif-dates 2 --files /my_folder_with_images --exclude-files /my_folder_with_images/ignored --dry-runWe welcome contributions to improve compatibility with more filename formats! If you encounter a filename format that isn't currently supported, consider submitting a pull request or opening an issue.
In particular, we are interested in:
- Adding new filename parsing functions.
- Enhancing error handling and logging.
- Improving false positive rates.
- Adding integration tests with real files.
- Fixing more clippy warnings.
- Switching to bindings for
libexifor other exif libraries. - Support more parent directory levels.
- Support asking ollama for a smarter date resolution powered by ai.
Your contributions help make image-date-fixer more robust and useful for everyone!
This project is released under either:
at your choosing.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.