How to use the exifread.utils function in ExifRead

To help you get started, we’ve selected a few ExifRead 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 ultralytics / velocity / utils / images.py View on Github external
def importEXIF(fullfilename):
    import exifread
    exif = exifread.process_file(open(fullfilename, 'rb'), details=False)
    for tag in exif.keys():
        a = exif[tag].values[:]
        if type(a) is str and a.isnumeric():
            a = float(a)
        if type(a) is list:
            n = a.__len__()
            a = np.asarray(a)
            for i in range(n):
                if type(a[i]) == exifread.utils.Ratio:
                    a[i] = float(a[i].num / a[i].den)
            if n == 1:
                a = a[0]
        exif[tag] = a
    # printd(exif)
    return exif
github mapillary / OpenSfM / opensfm / exif.py View on Github external
def get_tag_as_float(tags, key):
    if key in tags:
        val = tags[key].values[0]
        if isinstance(val, exifread.utils.Ratio):
            return eval_frac(val)
        else:
            return float(val)
    else:
        return None
github ultralytics / velocity / functions / fcns.py View on Github external
def importEXIF(fullfilename):
    exif = exifread.process_file(open(fullfilename, 'rb'), details=False)
    for tag in exif.keys():
        a = exif[tag].values[:]
        if type(a) == str and a.isnumeric():
            a = float(a)
        if type(a) == list:
            n = a.__len__()
            a = np.asarray(a)
            for i in range(0, n):
                if type(a[i]) == exifread.utils.Ratio:
                    a[i] = float(a[i].num / a[i].den)
            if n == 1:
                a = a[0]
        exif[tag] = a
    # printd(exif)
    return exif