Skip to content

Instantly share code, notes, and snippets.

@jericks
Created December 18, 2014 03:35
Show Gist options
  • Save jericks/4f7d006c300c0d423063 to your computer and use it in GitHub Desktop.
Save jericks/4f7d006c300c0d423063 to your computer and use it in GitHub Desktop.
offsetcalc
elif options.offsetcalc:
import exifread
from datetime import datetime
imgDate = datetime.strptime(args[0], "%Y-%m-%d %H:%M:%S")
f = open(args[1], 'rb')
tags = exifread.process_file(f)
f.close()
exifDateStr = tags['EXIF DateTimeDigitized'].values
exifDate = datetime.strptime(exifDateStr, "%Y:%m:%d %H:%M:%S")
diff = exifDate - imgDate
print diff.total_seconds()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment