Closed KosuzuMotoori closed 4 years ago
I haven't used this tag, and I'm trying to assign it:
>>> img.modify_iptc({'Iptc.Application2.Keywords': ['hello', 'world']})
>>> img.read_iptc()['Iptc.Application2.Keywords']
'hello, world'
Do you want it to return a list of string, ['hello', 'world']
?
The list would be better!
from pyexiv2 import Image
img = Image(r'/photo.jpg')
iptc = img.read_iptc()
print(iptc['Iptc.Application2.Keywords'])
img.close()
from iptcinfo3 import IPTCInfo
info = IPTCInfo('photo.jpg')
print(info['keywords'])
python3 test.py Summer [b'River', b'Boat', b'Sweden', b'Summer']
I will improve the code this weekend.
I've improved the code so that it can read and write duplicate IPTC keys now. I will release a new version in a few days.
Sample:
>>> from pyexiv2 import Image
>>> img = Image(r'.\pyexiv2\tests\1.jpg')
>>> img.modify_iptc({'Iptc.Application2.Keywords': ['tag1', 'tag2', 'tag3']})
>>> img.read_iptc()['Iptc.Application2.Keywords']
['tag1', 'tag2', 'tag3']
>>> img.close()
Thanks! It works!!!
This issue has been automatically closed because there has been no activity for a month.
Iptc.Application2.Keywords returs only one keyword, although there are several keywords in the image.