mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-13 10:46:16 +03:00
XMP feature added
This commit is contained in:
parent
2f29f1306f
commit
7968279c13
BIN
Tests/images/xmp_test.jpg
Normal file
BIN
Tests/images/xmp_test.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.7 MiB |
|
@ -2,7 +2,8 @@ from PIL import Image
|
||||||
|
|
||||||
|
|
||||||
def test_getxmp():
|
def test_getxmp():
|
||||||
im = Image.open("Tests/images/hopper.jpg")
|
im = Image.open("Tests/images/xmp_test.jpg")
|
||||||
type_repr = repr(type(im.getxmp()))
|
type_repr = repr(type(im.getxmp()))
|
||||||
|
|
||||||
assert "dict" in type_repr
|
assert "dict" in type_repr
|
||||||
|
assert isinstance(im.getxmp()['Description'][0]['Version'], int)
|
||||||
|
|
|
@ -1324,8 +1324,10 @@ class Image:
|
||||||
Returns an object containing the xmp tags for a given image.
|
Returns an object containing the xmp tags for a given image.
|
||||||
:returns: XMP tags in an object.
|
:returns: XMP tags in an object.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if self._xmp is None:
|
if self._xmp is None:
|
||||||
self._xmp = {}
|
self._xmp = {}
|
||||||
|
|
||||||
for segment, content in self.applist:
|
for segment, content in self.applist:
|
||||||
if segment == "APP1":
|
if segment == "APP1":
|
||||||
marker, xmp_tags = content.rsplit(b"\x00", 1)
|
marker, xmp_tags = content.rsplit(b"\x00", 1)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user