我想批量提取gps数据(exif),然后转换为地址并将该文本保存为jpg

时间:2018-09-18 03:42:55

标签: image gps jpeg exif

我有1500张照片,需要在照片的一角显示这些照片的地址。我的图片带有地理标签。 我需要帮助来提取GPS数据并将其转换为地址。 然后获取该地址并将其保存到右下角的图片中。任何人都可以帮忙或指出正确的方向吗?

2 个答案:

答案 0 :(得分:0)

You're going to need two things. First you need an application that will extract the EXIF data that you are interested in. You should be able to write this yourself as it is fairly simple to do. You will need the JPEG standard and just need enough of it to identify the markers; specifically the APPn markers. You are also going to need the EXIF and (possibly the) TIFF standards to figure out how to extract the data you need form the EXIF APPn marker.

Writing the information to the corner of the image is the tough part. There are probably command line applications that will allow you to do that already. If worst comes to worst, there are various language API's that will allow you to read a JPEG stream into a buffer; draw text to the buffer; then write the buffer back to a JPEG stream.

答案 1 :(得分:0)

您很可能需要为此使用编程语言;我认为Python非常适合,因为它很容易上手,并且具有执行任务所需的库。
例如,为了从JPEG文件中提取位置(坐标),可以使用pyexiv2
要将这些坐标转换为地址,您需要使用Google的Geocoding API等地理编码服务-您可以直接使用其Python library或使用类似requests的代码对自己的地址进行编码。
有了地址数据后,您就可以使用Python的pillow库将该数据叠加到图像上了。
如果您正在寻找入门的代码,请让我无耻地插入我自己的名为photomap的项目;您可以在此处找到用于从图像中读取GPS信息的代码:https://github.com/iticus/photomap/blob/master/handlers.py#L170