exifread

exifread



原图:

import exifread
f = open("./img/IMG_20230926_115803900.jpg", "rb")
tags = exifread.process_file(f)
print(tags)

读取的结果:

{

'Image Artist': (0x013B) ASCII=todayCam @ 98,
'Image ImageWidth': (0x0100) Long=2584 @ 30,
'Image ImageLength': (0x0101) Long=1940 @ 42,
'Image ExifOffset': (0x8769) Long=127 @ 54,
'Image Orientation': (0x0112) Short=Horizontal (normal) @ 66,
'Image DateTime': (0x0132) ASCII=2023:09:26 11:58:04 @ 107,
'GPS GPSLatitude': (0x0002) Ratio=[21, 28, 381/8] @ 6775,
'GPS GPSAltitude': (0x0006) Ratio=9/20 @ 6799,
'GPS GPSLatitudeRef': (0x0001) ASCII=N @ 6707,
'GPS GPSAltitudeRef': (0x0005) Byte=0 @ 6719,
'GPS GPSLongitudeRef': (0x0003) ASCII=E @ 6731,
'GPS GPSLongitude': (0x0004) Ratio=[111, 13, 4097/80] @ 6807,
'GPS GPSImgDirection': (0x0011) Ratio=507/5 @ 6831,
'GPS GPSImgDirectionRef': (0x0010) ASCII=T @ 6767,
'Image GPSInfo': (0x8825) Long=6673 @ 90,
'EXIF DateTimeOriginal': (0x9003) ASCII=2023:09:26 11:58:04 @ 181,
'EXIF DateTimeDigitized': (0x9004) ASCII=2023:09:26 11:58:04 @ 201,
'EXIF UserComment': (0x9286) Undefined= @ 221,
'EXIF LightSource': (0x9208) Long=Unknown @ 173
}

源代码:01|

latitude = tags["GPS GPSLatitude"].values
latitude_f = latitude[0].num / latitude[0].den + (latitude[1].num / latitude[1].den / 60) + (
latitude[2].num / latitude[2].den / 3600)

结果:

时间 = 2023:09:26 11:58:04
经度 = 111.23089236111112 N
纬度 = 21.47989583333333 E






BypInformation