EXIF.py

python 獲取圖片exif信息

Easy to use Python module to extract Exif metadata from tiff and jpeg files.

Originally written by Gene Cash & Thierry Bousch.

Installation

PyPI
The recommended process is to install the PyPI package, as it allows easily staying up to date:

$ pip install exifread
See the pip documentation for more info.

Usage


Some examples:

$ EXIF.py image1.jpg
$ EXIF.py image1.jpg image2.tiff
$ find ~/Pictures -name "*.jpg" -name "*.tiff" | xargs EXIF.py

Python Script

import exifread
# Open image file for reading (binary mode)
f = open(path_name, 'rb')

# Return Exif tags
tags = exifread.process_file(f)

Processing Options
These options can be used both in command line mode and within a script.

Faster Processing
Don’t process makernote tags, don’t extract the thumbnail image (if any).

Pass the -q or --quick command line arguments, or as:

tags = exifread.process_file(f, details=False)

Stop at a Given Tag
To stop processing the file after a specified tag is retrieved.

Pass the -t TAG or --stop-tag TAG argument, or as:

tags = exifread.process_file(f, stop_tag='TAG')

where TAG is a valid tag name, ex ‘DateTimeOriginal’.

The two above options are useful to speed up processing of large numbers of files.

Strict Processing
Return an error on invalid tags instead of silently ignoring.

Pass the -s or --strict argument, or as:

tags = exifread.process_file(f, strict=True)
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章