Last active
August 29, 2015 14:05
-
-
Save jczaplew/9e5883fd345b18937139 to your computer and use it in GitHub Desktop.
Add 11 hours to a directory of JPGs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Back up your photos before running this! | |
import pyexiv2 | |
import datetime | |
import glob | |
# Directory relative to where the script is -> change it to whatever you want | |
target_folder = "test" | |
hours_to_add = datetime.timedelta(hours=11) | |
time_keys = ["Exif.Image.DateTime", "Exif.Photo.DateTimeOriginal", "Exif.Photo.DateTimeDigitized"] | |
for file in glob.glob(target_folder + "/*.jpg"): | |
metadata = pyexiv2.ImageMetadata(file) | |
metadata.read() | |
for key in time_keys: | |
metadata[key] = metadata[key].value + hours_to_add | |
metadata.write() | |
print "Done processing all JPGs in " + target_folder |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment