I want to create a function that is going to search for metadata of JPG files using exifread, select the earliest date from Image DateTime
tag and print it. Here is the code I have so far (not much :D):
def GetExifTagsForFile(filename):
file = open(filename,'rb')
tags = exifread.process_file(file)
Usually, I would further create a list where I add all dates and then using min
select the earliest date. However, here I am trying to operate with IfdTag
for which this kind of solution will not work. The encoding of IfdTag
is %Y:%m:%d %H:%M:%S
. I have also tried to change tag's format to datetime
using strdtime
, however, this solution works only for strings. Do you have any suggestions how to solve my problem?