mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-03 22:06:18 +03:00
Merge pull request #10 from radarhere/feature_xmp
Changed list of single items dictionaries to dictionary
This commit is contained in:
commit
0084234aa9
|
@ -2,8 +2,8 @@ from PIL import Image
|
||||||
|
|
||||||
|
|
||||||
def test_getxmp():
|
def test_getxmp():
|
||||||
im = Image.open("Tests/images/xmp_test.jpg")
|
with Image.open("Tests/images/xmp_test.jpg") as im:
|
||||||
type_repr = repr(type(im.getxmp()))
|
xmp = im.getxmp()
|
||||||
|
|
||||||
assert "dict" in type_repr
|
assert isinstance(xmp, dict)
|
||||||
assert isinstance(im.getxmp()["Description"][0]["Version"], str)
|
assert xmp["Description"]["Version"] == "10.4"
|
||||||
|
|
|
@ -1334,10 +1334,10 @@ class Image:
|
||||||
if marker == b"http://ns.adobe.com/xap/1.0/":
|
if marker == b"http://ns.adobe.com/xap/1.0/":
|
||||||
root = xml.etree.ElementTree.fromstring(xmp_tags)
|
root = xml.etree.ElementTree.fromstring(xmp_tags)
|
||||||
for element in root.findall(".//"):
|
for element in root.findall(".//"):
|
||||||
xmp_atribs = []
|
self._xmp[element.tag.split("}")[1]] = {
|
||||||
for child, value in element.attrib.items():
|
child.split("}")[1]: value
|
||||||
xmp_atribs.append({child.split("}")[1]: value})
|
for child, value in element.attrib.items()
|
||||||
self._xmp.update({element.tag.split("}")[1]: xmp_atribs})
|
}
|
||||||
return self._xmp
|
return self._xmp
|
||||||
|
|
||||||
def getim(self):
|
def getim(self):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user