一、前言
目前好多照片都已经抹掉了设备信息、拍摄时间和GPS信息这种比较隐私的信息,除去这这种信息,其他的信息一般照片都能拿到。文末会给出可以查到完整信息的图片做参考。
二、准备
主要是用python 的ExifRead库获取照片信息
三、代码实现
1 安装依赖包
pip install exifread
2 具体代码
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查看器
五、测试样例
样例图片
|