Hi, I have found
######Read metadata on the original file fd = open(nfc, 'rb') d= fd.read() xmp_start = re.search(b'analySIS',d) xmp_end = re.search(b'Solutions',d) xmp_str = d[:xmp_end.span()[0]+11] xmp_str2 = d[xmp_start.span()[0]-16:] fd.close() ######Write img2.save(os.path.join(path2,nom)) fd = open(os.path.join(path2,nom), 'rb') d= fd.read() fd.close() d=xmp_str+d[140:]+xmp_str2 fd = open(os.path.join(path2,nom), 'w+b') fd.write(d) fd.close()