当前位置:网站首页>如何实现根据照片获取地理位置及如何防御照片泄漏地理位置
如何实现根据照片获取地理位置及如何防御照片泄漏地理位置
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
边栏推荐
- Number theory to find the sum of factors of a ^ B (A and B are 1e12 levels)
- RSA encryption and decryption signature verification
- Applet error: cannot read property'currenttarget'of undefined
- Summary of wrong questions 1
- Secrets in buffctf file 1
- DMP engine work summary (2021, lightsaber)
- Go language learning notes - structure | go language from scratch
- Wechat applet catchtap = "todetail" event problem
- Data visualization: use Excel to make radar chart
- MYCAT configuration
猜你喜欢

112. Path sum

The most concerned occupations after 00: civil servants ranked second. What was the first?

653. 两数之和 IV - 输入 BST

Simple understanding of arguments in JS

Kettle实验 (三)

What is monitoring intelligent playback and how to use intelligent playback to query video recording

Redis Desktop Manager for Mac

【读书笔记】《Verilog数字系统设计教程》 第5章 条件语句、循环语句和块语句(附思考题答案)

nn. Explanation of module class

Write down the post order traversal of the ~ binary tree
随机推荐
Distributed message oriented middleware framework selection - Digital Architecture Design (7)
《信息系统项目管理师总结》第八章 项目干系人管理
DJ music management software pioneer DJ rekordbox
Emuelec compilation summary
Applet error: should have URL attribute when using navigateto, redirectto or switchtab
成功的DevOps Leader 应该清楚的3个挑战
On array replication
How to read excel table to database
Operation not allowed for a result set of type resultset TYPE_ FORWARD_ ONLY. Explain in detail
Go language learning notes - exception handling | go language from scratch
JS prototype chain
GUI, CLI and UNIX Philosophy
kettle实验
Kettle实验 (三)
About CIN, scanf and getline, getchar, CIN Mixed use of getline
MYCAT configuration
Harbor enterprise image management system
EmuElec 编译总结
Write down the post order traversal of the ~ binary tree
MySQL of database -- basic common query commands