Created
July 28, 2020 02:14
-
-
Save hellojukay/87c14df1c80063a1118daf0a39677b6b to your computer and use it in GitHub Desktop.
读取照片的 EXIF 信息
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
#!/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