当前位置:网站首页>如何实现根据照片获取地理位置及如何防御照片泄漏地理位置
如何实现根据照片获取地理位置及如何防御照片泄漏地理位置
2022-04-23 09:24:00 【Python 集中营】

首先,说明一下python确实可以根据照片获取地理位置,但是也是有一定的限制条件的。
获取照片地理位置的实现思路是这样的:通过提取照片中的经纬度信息。然后通过经纬度信息找到具体的地理位置信息。
安装可以读取经纬度信息的python非标准库exifread
pip install exifread
将该模块导入到当前代码块中。
import exifread as ex
编写照片信息读取函数,获取照片中的经纬度信息。
def read_image():
'''
经纬度信息读取函数
:return:
'''
image = open('C:/sc.jpg', 'rb') # 打开照片文件
messages = ex.process_file(image) # 获取照片信息
'''遍历提取照片信息'''
for message in messages:
print('照片信息:', message)
if message == "GPS GPSLongitude":
print("经度 =", messages[message], messages['GPS GPSLatitudeRef'])
elif message == "GPS GPSLatitude":
print("纬度 =", messages[message], messages['GPS GPSLongitudeRef'])
if __name__ == '__main__':
read_image()
通过上面的处理已经获取当前的经纬度信息,现在只需要根据经纬度信息获取具体的地理位置就可以了。
直接使用web网站去查询地理位置就可以了。
地理位置转换网址:http://www.giscalculator.com/enter_regeocode_input/

最后,那么如何防止自己的手机照片被追踪到地址呢,需要说明一下照片被获取地理位置信息的硬性条件。
1、手机是安卓手机才会出现被追踪位置的情况。 2、手机拍摄时开启了GPS定位的照片才会存储GPS位置信息,否则是获取不到的。 3、手机照片在发送过程中必须是原图发送才会出现将照片其他信息发送给别人的情况。
根据上面情况,手机在拍照时关闭定位、发送给别人照片时为避免信息泄漏不要使用原图发送,若是苹果手机暂时不用担心啦!
【往期精彩】
又是樱花盛开的季节,使用小乌龟来画一颗樱花树吧!
Python 读取PDF文件为文本字符并转换为音频...
python 获取最新房价信息-以北京房价为例
办公自动化:Image图片转换成PDF文档存储...
python做一个微型美颜图片处理器,十行代码即可完成...
用python做一个文本翻译器,自动将中文翻译成英文,超方便的!
小王,给这2000个客户发一下节日祝福的邮件...
python 一行命令开启网络间的文件共享...
PyQt5 批量删除 Excel 重复数据,多个文件、自定义重复项一键删除...
再见XShell,这款国人开源的终端命令行工具更nice!
python 表情包下载器,轻松下载上万个表情包、斗图不用愁...
Python 自动清理电脑垃圾文件,一键启动即可...
版权声明
本文为[Python 集中营]所创,转载请带上原文链接,感谢
https://blog.csdn.net/chengxuyuan_110/article/details/124355467
边栏推荐
- Single sign on SSO
- Cloud computing competition -- basic part of 2020 competition [task 3]
- Creation of raid0 and RAID5 and Simulation of how RAID5 works
- Enter "net start MySQL" and "system error 5. Access denied" appears. Detailed explanation of the problem
- Kettle experiment (III)
- Image processing in opencv -- Introduction to contour + contour features
- Summary of common concepts and problems of linear algebra in postgraduate entrance examination
- Get trustedinstaller permission
- Brush classic topics
- 2D 01 Backpack
猜你喜欢

Notes on xctf questions

MySQL小练习(仅适合初学者,非初学者勿进)

Go language learning notes - slice, map | go language from scratch

MySQL of database -- basic common query commands
![[reading notes] Chapter 5 conditional statements, circular statements and block statements of Verilog digital system design tutorial (with answers to thinking questions)](/img/a2/b50fadad859a050eecfa15a436e126.png)
[reading notes] Chapter 5 conditional statements, circular statements and block statements of Verilog digital system design tutorial (with answers to thinking questions)

Secrets in buffctf file 1

Vivo, hardware safe love and thunder

Four pictures to understand some basic usage of Matplotlib

Distributed message oriented middleware framework selection - Digital Architecture Design (7)

Kettle实验 (三)
随机推荐
Notes on xctf questions
小程序报错:Cannot read property 'currentTarget' of undefined
Codeforces Round #784 (Div. 4)
tsdf +mvs
Matlab draw five-star red flag
Go language self-study series | golang method
Applet error: should have URL attribute when using navigateto, redirectto or switchtab
Get trustedinstaller permission
Thread scheduling (priority)
MySQL small exercise (only suitable for beginners, non beginners are not allowed to enter)
SAP 101K 411K 库存变化
About CIN, scanf and getline, getchar, CIN Mixed use of getline
LeetCode396. Rotate array
Kettle experiment
What is monitoring intelligent playback and how to use intelligent playback to query video recording
Project upload part
Leetcode-199 - right view of binary tree
108. 将有序数组转换为二叉搜索树
Kettle实验 (三)
Using sqlmap injection to obtain the account and password of the website administrator