BitMover/_image_tag.py

22 lines
715 B
Python

import exifread
from _time_and_date_utils import get_img_date
class ImageTag:
def __init__(self,path_file_name,*args,**kwargs):
super(ImageTag,self).__init__(*args,**kwargs)
self.path_file_name = path_file_name
self.image_tags = self.get_image_tags()
self.date_time_original = get_img_date(self.image_tags)
def get_image_tag(self,t):
tag_data = None
for tag in self.image_tags:
if t.lower() in tag.lower():
tag_data = self.image_tags[tag]
break
return tag_data
def get_image_tags(self):
with open(self.path_file_name,'rb') as f:
tags = exifread.process_file(f)
return tags