Skip to content

Instantly share code, notes, and snippets.

@hellojukay
Created July 28, 2020 02:14
Show Gist options
  • Save hellojukay/87c14df1c80063a1118daf0a39677b6b to your computer and use it in GitHub Desktop.
Save hellojukay/87c14df1c80063a1118daf0a39677b6b to your computer and use it in GitHub Desktop.
读取照片的 EXIF 信息
#!/bin/python
import glob
import exifread
from dateutil.parser import parse
files = glob.glob("*.JPG")
for file in files:
fh = open(file,"rb")
tags = exifread.process_file(fh)
# tags 包含了照片的所有信息
# 读取拍摄时间信息
date = tags['EXIF DateTimeOriginal']
date = parse(str(date))
print(date)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment