Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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
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
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