Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Simple Exif manipulation script
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)
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)
raw_input('Job finished.')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.