LeoHsiao1 / pyexiv2

Read and write image metadata, including EXIF, IPTC, XMP, ICC Profile.
GNU General Public License v3.0
197 stars 39 forks source link

Incorrect values after modify_xmp #64

Closed HamzaFarhan closed 3 years ago

HamzaFarhan commented 3 years ago

I'm trying to modify the ToneCurve values of an image.

These are the original: {'Xmp.crs.ToneCurveName2012': 'Linear', 'Xmp.crs.ToneCurvePV2012': ['0', '0', '255', '255'], 'Xmp.crs.ToneCurvePV2012Red': ['0', '0', '255', '255'], 'Xmp.crs.ToneCurvePV2012Green': ['0', '0', '255', '255'], 'Xmp.crs.ToneCurvePV2012Blue': ['0', '0', '255', '255']}

These are the ones I want to set: {'Xmp.crs.ToneCurveName2012': 'Custom', 'Xmp.crs.ToneCurvePV2012': ['0', '11', '32', '25', '67', '74', '114', '131', '176', '181', '252', '230'], 'Xmp.crs.ToneCurvePV2012Red': ['0', '0', '54', '37', '183', '196', '255', '255'], 'Xmp.crs.ToneCurvePV2012Green': ['0', '0', '68', '49', '173', '185', '255', '255'], 'Xmp.crs.ToneCurvePV2012Blue': ['0', '0', '65', '48', '190', '203', '255', '255']}

This is what I end up with after using modify_xmp: {'Xmp.crs.ToneCurveName2012': 'Custom', 'Xmp.crs.ToneCurvePV2012': '230', 'Xmp.crs.ToneCurvePV2012Red': '255', 'Xmp.crs.ToneCurvePV2012Green': '255', 'Xmp.crs.ToneCurvePV2012Blue': '255'}

It seems to only be getting the last value from the modified dict's lists.

LeoHsiao1 commented 3 years ago

Thank you for reporting this bug:

>>> img.modify_xmp({'Xmp.crs.ToneCurvePV2012': ['0', '0', '255', '255']})
>>> img.read_xmp()
{'Xmp.crs.ToneCurvePV2012': '255'}

I'll try to fix it over the weekend. Either exiv2 doesn't support modifying it, or I made a mistake converting the data type.

LeoHsiao1 commented 3 years ago

I just released v2.6.0. It can write list-type values to these tags.

HamzaFarhan commented 3 years ago

I'm getting this error now which I was not getting before: OSError: /lib/x86_64-linux-gnu/libm.so.6: version `GLIBC_2.29' not found (required by /home/hamza/anaconda3/envs/dreamai/lib/python3.9/site-packages/pyexiv2/lib/libexiv2.so)

LeoHsiao1 commented 3 years ago

I compiled it using Ubuntu 20.04, whose Glibc version is 2.29. So, if you are a Linux user, you need to update glibc, or upgrade your Linux distribution.

HamzaFarhan commented 3 years ago

I've upgraded Linux. When can you can v2.6 up and running again?

LeoHsiao1 commented 3 years ago

I have disabled pyexiv2 2.6.0 on pypi.org because it is not compatible with MacOS 11. I'll spend a few days looking at MacOS 11. Until I fix the problem, you can download the 2.6.0 release on GitHub.

HamzaFarhan commented 3 years ago

It's working fine now. Thank you.

github-actions[bot] commented 2 years ago

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