How to use the exif.getexif function in exif

To help you get started, we’ve selected a few exif examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github albertz / helpers / rename-pics.py View on Github external
def dump_exif(f):
    print("File", f, ":")
    try:
        info = exif.getexif(f)
    except exif.ExifException as e:
        print("  Error:", e)
    else:
        for k in sorted([k for k in info if isinstance(k, str)]) + sorted([k for k in info if not isinstance(k, str)]):
            print(" ", k, ":", user_repr(info[k]))
    print("  file creation time:", file_time_creation(f))
github albertz / helpers / rename-pics.py View on Github external
def iminfo(f):
    try:
        info = cleanup_exif_tags(exif.getexif(f))
    except exif.ExifException:
        info = {}
    if "DateTimeOriginal" in info:
        info["DateTime"] = info["DateTimeOriginal"]
    if "DateTime" not in info:
        info["DateTime"] = file_time_creation(f)
    return info