Created
May 21, 2012 07:33
-
-
Save barosl/2760954 to your computer and use it in GitHub Desktop.
Simple Exif manipulation script
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
HOURS_DIFFERENCE = 9 # can be negative | |
import os | |
import time | |
import datetime | |
import pyexiv2 | |
for fname in os.listdir('.'): | |
if fname.lower().endswith('.jpg'): | |
print fname | |
fp = pyexiv2.ImageMetadata(fname) | |
fp.read() | |
for key in fp.exif_keys: | |
if 'Date' not in key: continue | |
tag = fp[key] | |
if not isinstance(tag.value, datetime.datetime): continue | |
tag.value = tag.value + datetime.timedelta(hours=HOURS_DIFFERENCE) | |
fp.write() | |
raw_input('Job finished.') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment