Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Iptc.Application2.Keywords problem #18

Closed
KosuzuMotoori opened this issue Mar 31, 2020 · 8 comments
Closed

Iptc.Application2.Keywords problem #18

KosuzuMotoori opened this issue Mar 31, 2020 · 8 comments
Labels

Comments

@KosuzuMotoori
Copy link

Iptc.Application2.Keywords returs only one keyword, although there are several keywords in the image.

@LeoHsiao1
Copy link
Owner

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'] ?

@KosuzuMotoori
Copy link
Author

The list would be better!

@KosuzuMotoori
Copy link
Author

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']

@LeoHsiao1
Copy link
Owner

I will improve the code this weekend.

@LeoHsiao1
Copy link
Owner

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()

@LeoHsiao1
Copy link
Owner

I have released a new version, v2.2.0, please try it.

@KosuzuMotoori
Copy link
Author

Thanks! It works!!!

@github-actions
Copy link

github-actions bot commented Aug 2, 2021

This issue has been automatically closed because there has been no activity for a month.

@github-actions github-actions bot locked and limited conversation to collaborators Aug 2, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants