从图片提取经纬度简易版
[Python] 纯文本查看 复制代码 import exifread
import re
def imageread():
GPS = {}
date = ''
f = open('./2018*****59171.jpg', 'rb')
imagetext = exifread.process_file(f)
for key in imagetext: #打印键值对
print(key,":",imagetext[key])
print('********************************************************\n')
for q in imagetext: #打印该图片的经纬度 以及拍摄的时间
if q == "GPS GPSLongitude":
print("GPS经度 =", imagetext[q],imagetext['GPS GPSLatitudeRef'])
elif q =="GPS GPSLatitude":
print("GPS纬度 =",imagetext[q],imagetext['GPS GPSLongitudeRef'])
elif q =='Image DateTime':
print("拍摄时间 =",imagetext[q])
imageread()
运行效果如图
不过要先准备一张带位置的照片。 |