网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。
一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!
有媒体曝出,微信发原图或存在泄露位置信息的风险。
对此,腾讯微信团队微博12月1日发布声明称,朋友圈发送的照片都经过系统自动压缩,不带位置等信息,实在担心的话,可以P完图再发,如下图:
微信团队提到过Exif,何为Exif?
可交换图像文件格式(英语:Exchangeable image file format,官方简称Exif),是专门为数码相机的照片设定的,可以记录数码照片的属性信息和拍摄数据。
Exif最初由日本电子工业发展协会在1996年制定,版本为1.0。1998年,升级到2.1,增加了对音频文件的支持。2002年3月,发表了2.2版。
这里需要Python的两个库,一个是读取Exif信息的exifread;一个是根据经纬度获取详细地址信息的geopy;
安装如下:
pip3 install exifread
pip3 install geopy
import exifread
import json
import urllib.request
import sys
from geopy.geocoders import Nominatim
获取照片的详细信息
def get_img_infor_tup(photo):
img_file = open(photo, ‘rb’)
image_map = exifread.process_file(img_file)
try:
#图片的经度
img_longitude_ref = image_map[“GPS GPSLongitudeRef”].printable
img_longitude = image_map[“GPS GPSLongitude”].printable[1:-1].replace(" “,”“).replace(”/“,”,“).split(”,")
img_longitude = float(img_longitude[0])+float(img_longitude[1])/60+float(img_longitude[2])/float(img_longitude[3])/3600
if img_longitude_ref != “E”:
img_longitude = img_longitude * (-1)
#图片的纬度
img_latitude_ref = image_map[“GPS GPSLatitudeRef”].printable
img_latitude = image_map[“GPS GPSLatitude”].printable[1:-1].replace(" “,”“).replace(”/“,”,“).split(”,")
img_latitude = float(img_latitude[0])+float(img_latitude[1])/60+float(img_latitude[2])/float(img_latitude[3])/3600
if img_latitude_ref != “N”:
img_latitude = img_latitude*(-1)
#照片拍摄时间
img_create_date = image_map[“EXIF DateTimeOriginal”].printable
img_file.close()
返回经纬度元组
return img_longitude, img_latitude, img_create_date
except Exception as e:
print(‘ERROR:图片中不包含Gps信息’)
根据经纬度获取详细的信息
def get_detail_infor(lat, lon):
reverse_value = str(lat) + ', ’ + str(lon)
geolocator = Nominatim()
location = geolocator.reverse(reverse_value)
print(‘照片的经纬度信息:’)
print((location.latitude, location.longitude))
print(‘照片的地址信息:’)
print(location.address)
print(‘照片的全部信息:’)
print(location.raw)
if name == ‘main’:
infor_tup = get_img_infor_tup(‘./image/IMG_2174.JPG’)
get_detail_infor(infor_tup[1], infor_tup[0])
最后
不知道你们用的什么环境,我一般都是用的Python3.6环境和pycharm解释器,没有软件,或者没有资料,没人解答问题,都可以免费领取(包括今天的代码),过几天我还会做个视频教程出来,有需要也可以领取~
给大家准备的学习资料包括但不限于:
Python 环境、pycharm编辑器/永久激活/翻译插件
python 零基础视频教程
Python 界面开发实战教程
Python 爬虫实战教程
Python 数据分析实战教程
python 游戏开发实战教程
Python 电子书100本
Python 学习路线规划
网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。
一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!