当前位置:网站首页>如何实现根据照片获取地理位置及如何防御照片泄漏地理位置
如何实现根据照片获取地理位置及如何防御照片泄漏地理位置
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
边栏推荐
- Learn FPGA (from Verilog to HLS)
- [geek challenge 2019] havefun1
- RSA 加密解密签名验签
- JS prototype chain
- [58] length of the last word [leetcode]
- I don't understand time, timestamp and time zone. Look at this article
- LeetCode_ DFS_ Medium_ 1254. Count the number of closed islands
- Base de la technologie électronique numérique 3.1 aperçu du circuit de porte, 3.2 circuit de porte à diode semi - conductrice
- MySQL of database -- basic common query commands
- What is augmented reality technology? Where can it be used?
猜你喜欢
Brush classic topics
A must see wechat applet development guide 1 - basic knowledge
I don't understand time, timestamp and time zone. Look at this article
Failed to download esp32 program, prompting timeout
Go language learning notes - structure | go language from scratch
Go language learning notes - exception handling | go language from scratch
Kettle实验 转换案例
Notes on xctf questions
机器学习(六)——贝叶斯分类器
数据清洗 ETL 工具Kettle的安装
随机推荐
小程序报错:Cannot read property 'currentTarget' of undefined
Wechat applet catchtap = "todetail" event problem
Employee probation application (Luzhou Laojiao)
EmuElec 编译总结
112. Path sum
Two declaration methods of functions of JS
JS case to find the maximum value, reverse the array, bubble sort
Chapter VIII project stakeholder management of information system project manager summary
Thread scheduling (priority)
MYCAT configuration
#yyds干货盘点#ubuntu18.0.4安装mysql并解决ERROR 1698: Access denied for user ''root''@''localhost''
AQS & reentrantlock implementation principle
Data visualization: use Excel to make radar chart
Enter "net start MySQL" and "system error 5. Access denied" appears. Detailed explanation of the problem
Common errors of VMware building es8
STM32 and FreeRTOS stack parsing
How to render web pages
501. 二叉搜索树中的众数
Redis Desktop Manager for Mac
Principle of synchronized implementation