I use IPTCInfo3 in my Python app to write keywords to the IPCT metadata of an image.
For some reason if I use info.save()
it creates a copy of the original, e.g. it will write the keyword to Clean.JPG but will also create Clean.JPG~ without the keywords.
If I use info.save_as('Clean.jpg')
instead (try to force it to overwrite the original), it doesn't write the keywords to the file.
Is there a solution to this?
import iptcinfo3
new_keyword = ["cool", "sad", "blah"]
info = iptcinfo3.IPTCInfo('C:/Tmp/IPTCINFO/Clean.JPG')
for keyword in new_keyword:
if keyword.encode('UTF-8') not in info['keywords']:
info['keywords'].append(keyword)
info.save()