-
Notifications
You must be signed in to change notification settings - Fork 39
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
Writing arrays into exif segment is not working #12
Comments
Hi! I tried to read the tag you mentioned and found it was like this: >>> import pyexiv2
>>> img = pyexiv2.Image(r'C:\Users\Leo\Desktop\IMG_20200105_115821.jpg')
>>> img.read_exif()['Exif.GPSInfo.GPSLongitude']
'114/1 2/1 426696/10000' So I modified it in the same format. It works: >>> img.modify_exif({'Exif.GPSInfo.GPSLongitude': '200/1 2/1 400000/10000'})
>>> img.read_exif()['Exif.GPSInfo.GPSLongitude']
'200/1 2/1 400000/10000' Next, you just need to convert it from string to list: >>> '200/1 2/1 400000/10000'.split(' ')
['200/1', '2/1', '400000/10000']
>>> ' '.join(['200/1', '2/1', '400000/10000'])
'200/1 2/1 400000/10000' Does that solve your problem? |
Hi, Thanks for the quick answer. Actually, that works, thanks! I though I tried that, but I was converting Fraction object into string directly with Thanks. |
This issue has been automatically closed because there has been no activity for a month. |
Some Exif tags store a list of values, such as GPS latitude and longitude, which take a list of three rationals to store the angle in a "degrees minutes seconds" format.
For example, one would expect to be able to write something in the form
and read back successfully the values.
Looking at the api C++ code, arrays seems to be supported in the XMP segments. I believe that porting the same behaviour to the exif part should be straightforward.
Thanks for the good work!
The text was updated successfully, but these errors were encountered: