pyexif
pyexif copied to clipboard
Warning: [minor] Entries in ExifIFD were out of sequence. Fixed
When using the setTag() function inside a for loop(multiple files in a directory), I am getting the following error: "Warning: [minor] Entries in ExifIFD were out of sequence. Fixed". And the for loop halts for a while like 2-3 mins and then continues. Is there a fix to this or am I doing something wrong? Please find my code snippet below:
cwd=os.getcwd()
for f in sorted(os.listdir(cwd)):
try:
image = Image.open(f)
metadata = pyexif.ExifEditor(f)
exif = json.loads(metadata.getTag('UserComment'))
exif["header"]["device_id"]="m02-test"
exif_str = json.dumps(exif)
metadata.setTag('UserComment', exif_str)