0

我正在尝试从JPG图像中提取 GPS 坐标,但我没有得到太多信息pillow

这是我的第一次尝试:

from PIL import Image
from PIL.ExifTags import TAGS

my_img = Image.open("IMG_0547.jpg")

exif_data = my_img.getexif()
for tag_id in exif_data:
    tag = TAGS.get(tag_id, tag_id)
    data = exif_data.get(tag_id)

    print(f"{tag:16}: {data}")

输出:

TileWidth       : 512
TileLength      : 512
GPSInfo         : 1996
ResolutionUnit  : 2
ExifOffset      : 216
Make            : Apple
Model           : iPhone XS
Software        : 13.6
Orientation     : 1
DateTime        : 2020:08:13 21:01:41
XResolution     : 72.0
YResolution     : 72.0

从这里下载图像

我也尝试过使用pyexiv2,但我得到这个错误只有 o 行 metadata = pyexiv2.ImageMetadata('IMG_0547.jpg')没有意义的代码,因为这里ImageMetadata的官方文档中列出了

Traceback (most recent call last):
  File "maps.py", line 17, in <module>
    metadata = pyexiv2.ImageMetadata('IMG_0547.jpg')
AttributeError: module 'pyexiv2' has no attribute 'ImageMetadata'

有人可以帮我获取坐标吗?

4

0 回答 0