Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
"""
Read Exif metadata from tiff and jpeg files.
"""
from .exif_log import get_logger
from .classes import *
from .tags import *
from .utils import ord_
from .heic import HEICExifFinder
__version__ = '2.2.0'
logger = get_logger()
def increment_base(data, base):
return ord_(data[base + 2]) * 256 + ord_(data[base + 3]) + 2
def process_file(f, stop_tag=DEFAULT_STOP_TAG, details=True, strict=False, debug=False, truncate_tags=True, auto_seek=True):
"""
Process an image file (expects an open file object).
This is the function that has to deal with all the arbitrary nasty bits
of the EXIF standard.
"""
if auto_seek:
f.seek(0)
import struct
import re
from .exif_log import get_logger
from .utils import Ratio
from .tags import *
logger = get_logger()
try:
basestring
except NameError:
basestring = str
class IfdTag:
"""
Eases dealing with tags.
"""
def __init__(self, printable, tag, field_type, values, field_offset,
field_length):
# printable version of data
self.printable = printable
# tag ID number