欧美三区_成人在线免费观看视频_欧美极品少妇xxxxⅹ免费视频_a级毛片免费播放_鲁一鲁中文字幕久久_亚洲一级特黄

Python讀取圖片EXIF信息類庫介紹和使用實例

系統 2231 0

首先要介紹的是 Python Imaging Library,使用方法如下:

復制代碼 代碼如下:

from PIL import Image
from PIL.ExifTags import TAGS

def get_exif_data(fname):
??? """Get embedded EXIF data from image file."""
??? ret = {}
??? try:
??????? img = Image.open(fname)
??????? if hasattr( img, '_getexif' ):
??????????? exifinfo = img._getexif()
??????????? if exifinfo != None:
??????????????? for tag, value in exifinfo.items():
??????????????????? decoded = TAGS.get(tag, tag)
??????????????????? ret[decoded] = value
??? except IOError:
??????? print 'IOERROR ' + fname
??? return ret

if __name__ == '__main__':
??? fileName = 'C:/Users/Leyond/Desktop/IMG_20121122_153514.jpg'
??? exif = get_exif_data(fileName)
??? print exif


返回的清單如下:

復制代碼 代碼如下:

ExifVersion
ComponentsConfiguration
ExifImageWidth
DateTimeOriginal
DateTimeDigitized
ExifInteroperabilityOffset
FlashPixVersion
MeteringMode
LightSource
Flash
FocalLength
41986
ImageDescription
Make
Model
Orientation
YCbCrPositioning
41988
XResolution
YResolution
59932
ExposureTime
ExposureProgram
ColorSpace
41990
ISOSpeedRatings
ResolutionUnit
41987
FNumber
Software
DateTime
ExifImageHeight
ExifOffset

其中59932,是一大串十六進制的字符,不知為啥。除了PIL之外,還有許多類庫可供使用:

Media Metadata for Python

EXIF.py

Python Exif Parser

A Blogger's Exif Parser

pyexiv2


接著看EXIF.PY,使用方法非常簡單:exif.py IMG_20121122_153514.jpg

復制代碼 代碼如下:

EXIF ColorSpace (Short): sRGB
EXIF ComponentsConfiguration (Undefined): YCbCr
EXIF DateTimeDigitized (ASCII): 2012:11:22 15:35:14
EXIF DateTimeOriginal (ASCII): 2012:11:22 15:35:14
EXIF DigitalZoomRatio (Ratio): 1
EXIF ExifImageLength (Long): 2560
EXIF ExifImageWidth (Long): 1920
EXIF ExifVersion (Undefined): 0220
EXIF ExposureBiasValue (Signed Ratio): 0
EXIF ExposureMode (Short): Auto Exposure
EXIF ExposureProgram (Short): Portrait Mode
EXIF ExposureTime (Ratio): 1/256
EXIF FNumber (Ratio): 14/5
EXIF Flash (Short): Flash did not fire
EXIF FlashPixVersion (Undefined): 0100
EXIF FocalLength (Ratio): 35
EXIF ISOSpeedRatings (Short): 56
EXIF InteroperabilityOffset (Long): 4810
EXIF LightSource (Short): other light source
EXIF MeteringMode (Short): CenterWeightedAverage
EXIF Padding (Undefined): []
EXIF SceneCaptureType (Short): Portrait
EXIF WhiteBalance (Short): Auto
Image DateTime (ASCII): 2012:11:24 09:44:50
Image ExifOffset (Long): 2396
Image ImageDescription (ASCII):
Image Make (ASCII):
Image Model (ASCII):
Image Orientation (Short): Horizontal (normal)
Image Padding (Undefined): []
Image ResolutionUnit (Short): Pixels/Inch
Image Software (ASCII): Microsoft Windows Photo Viewer 6.1.7600.16385
Image XResolution (Ratio): 72
Image YCbCrPositioning (Short): Co-sited
Image YResolution (Ratio): 72
Thumbnail Compression (Short): JPEG (old-style)
Thumbnail JPEGInterchangeFormat (Long): 4970
Thumbnail JPEGInterchangeFormatLength (Long): 3883
Thumbnail Orientation (Short): Horizontal (normal)
Thumbnail ResolutionUnit (Short): Pixels/Inch
Thumbnail XResolution (Ratio): 72
Thumbnail YCbCrPositioning (Short): Co-sited
Thumbnail YResolution (Ratio): 72

至于Python Exif Parser,好像沒更新很久了,使用方法也很類似:

復制代碼 代碼如下:

import exif
photo_path = "somePath\to\a\photo.jpg"
data = exif.parse(photo_path)

其他類庫請自行研究。


更多文章、技術交流、商務合作、聯系博主

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號聯系: 360901061

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。

【本文對您有幫助就好】

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描上面二維碼支持博主2元、5元、10元、自定義金額等您想捐的金額吧,站長會非常 感謝您的哦!!!

發表我的評論
最新評論 總共0條評論
主站蜘蛛池模板: 亚洲综合五月天欧美 | 999精品视频| 99爱在线观看 | 日韩欧美一区二区三区不卡在线 | 欧美激情久久欧美激情 | 二区视频 | 国产成人精品福利网站在线观看 | 色综合天天综合网国产成人网 | 六月色播 | 波多野结衣一区二区三区在线观看 | 一级毛片在线观看视频 | 一二三区av | 精品国产一区二区三区久久久蜜月 | 久久综合一区 | 午夜久久久久久禁播电影 | 午夜精品一区 | 久久综合色婷婷 | 亚洲日本中文 | 男人用嘴添女人下身免费视频 | 日韩精品一区二区三区在线观看 | 黄色a视频 | 仇爱电视剧泰剧在线观看免费播放 | 免费观看视频www | 久久国产精品一区 | 99欧美精品| 久久在线观看 | 精品国产成a人在线观看 | 国产欧美日本 | 天天怕夜夜怕狠狠怕 | 九九热国产视频 | 日日碰狠狠添天天爽五月婷 | www.309809.com| 天天搞夜夜爽 | 毛片毛片毛片毛片毛片毛片 | 国产在线精品二区韩国演艺界 | 99精品在线 | 99thz桃花论坛 | 色爱综合网 | 九一免费在线观看 | 亚洲欧美日韩一区二区在线观看 | 欧美成年视频 |