python获取照片EXIF信息

一、前言

目前好多照片都已经抹掉了设备信息、拍摄时间和GPS信息这种比较隐私的信息,除去这这种信息,其他的信息一般照片都能拿到。文末会给出可以查到完整信息的图片做参考。

二、准备

主要是用pythonExifRead库获取照片信息

三、代码实现

1 安装依赖包

pip install exifread

2 具体代码

# -*- coding: utf-8 -*-
import exifread

def read():
	with open("001.jpg", 'rb') as f:
		tags = exifread.process_file(f)
		for tag in tags.keys():
			if tag not in ('JPEGThumbnail', 'TIFFThumbnail', 'Filename', 'EXIF MakerNote'):
				print("%s:, %s" % (tag, tags[tag]))

if __name__ == '__main__':
	read()

四、参数详解

1 程序运行后结果

Image Make:, HUAWEI
Image Model:, Che1-CL20
Image Orientation:, Horizontal (normal)
Image XResolution:, 72
Image YResolution:, 72
Image ResolutionUnit:, Pixels/Inch
Image YCbCrPositioning:, Centered
Image ExifOffset:, 156
GPS GPSLatitudeRef:, N
GPS GPSLatitude:, [36, 15, 241699/10000]
GPS GPSLongitudeRef:, E
GPS GPSLongitude:, [117, 6, 35211/2500]
GPS GPSAltitudeRef:, 0
GPS GPSAltitude:, 1501
GPS GPSTimeStamp:, [21, 27, 57]
GPS GPSProcessingMethod:, ASCII
GPS GPSDate:, 2016:05:16
Image GPSInfo:, 546
Thumbnail Compression:, JPEG (old-style)
Thumbnail XResolution:, 72
Thumbnail YResolution:, 72
Thumbnail ResolutionUnit:, Pixels/Inch
Thumbnail JPEGInterchangeFormat:, 858
Thumbnail JPEGInterchangeFormatLength:, 6885
EXIF ExposureTime:, 1/3099
EXIF FNumber:, 2
EXIF ISOSpeedRatings:, 100
EXIF ExifVersion:, 0220
EXIF DateTimeOriginal:, 2016:05:17 05:27:58
EXIF DateTimeDigitized:, 2002:12:08 12:00:00
EXIF ComponentsConfiguration:, YCbCr
EXIF ShutterSpeedValue:, 11597/1000
EXIF ApertureValue:, 2
EXIF Flash:, Flash did not fire, auto mode
EXIF FocalLength:, 379/100
EXIF FlashPixVersion:, 0100
EXIF ColorSpace:, sRGB
EXIF ExifImageWidth:, 4208
EXIF ExifImageLength:, 2368
Interoperability InteroperabilityIndex:, R98
Interoperability InteroperabilityVersion:, [48, 49, 48, 48]
EXIF InteroperabilityOffset:, 516
EXIF ExposureIndex:, 94
EXIF WhiteBalance:, Auto
EXIF FocalLengthIn35mmFilm:, 27
EXIF GainControl:, Low gain up

2 参数对比

如1所得到的结果非专业人员不太好理解,所以,我找到了一个解析的网站,大家可以对比判断结果。图虫EXIF查看器

五、测试样例

样例图片

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

倾云鹤

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值