-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Closed
Labels
Description
What did you do?
I tried to get the xmp data from the image with following code
im = Image.open("filename.jpg")
im.getxmp()What did you expect to happen?
I expect it returns the xmp dict, but it raise the error
File ~/miniconda3/envs/img-crop/lib/python3.12/site-packages/PIL/Image.py:1512, in Image.getxmp(self)
1510 if "xmp" not in self.info:
1511 return {}
-> 1512 root = ElementTree.fromstring(self.info["xmp"].rstrip(b"\x00"))
1513 return {get_name(root.tag): get_value(root)}
AttributeError: 'tuple' object has no attribute 'rstrip'seems the im.info['xmp'] is a single element tuple, where the element is the actual byte string data that should be processed.
I'm not sure whether it should be fixed at xmp data reading or parsing.
Thanks!
What are your OS, Python and Pillow versions?
- OS: windows 11
- Python: 3.12.2
- Pillow: 11.1.0
- defusedxml: 0.7.1