This project includes two Python scripts:
photo_date_extractor.py
: Given a folder, will iterate over all the photos to extract all date metadata into a CSV file.photo_date_updater.py
: Given a CSV file containing will update the EXIF DateTimeOriginal field for each photo specified.
The scripts rely on the following Python libraries:
piexif
Pillow
pyheif
-
Clone the repository
-
[recommended] Create and activate a Python virtual environment. One way (but not the only way) to do this is:
python -m venv .venv source .venv/bin/activate
-
Install the dependencies:
cd photo_tools pip install -r requirements.txt
-
Run the scripts:
python photo_date_extractor.py <folder_path> [-o <output_file>]
Optionally open the output_file and make any changes to Set Date. The script attempts to pick the most sensible value, but can make mistakes.
Then use the file as the input into the next script:
python photo_date_updater.py --csv <csv_file>
photo_date_extractor.py
is read-onlyphoto_date_updater.py
will write to the EXIF metadata of the photos in the input file. Please ensure this is what you want to do before running this script.
As a reminder, THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND.
We highly recommend you make bakup copies of your photos before running the photo_date_updater.py
script on them, so you can determine if the script is making the appoprorpiate changes that you want.