-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Closed
Labels
Description
Tag values (not attributes) are ignored when constructing the XMP from JpegImageFile.getxmp.
My (panorama) image has XMP (APP1):
http://ns.adobe.com/xap/1.0/\x00
<?xpacket begin='\xef\xbb\xbf' id='W5M0MpCehiHzreSzNTczkc9d'?>
<x:xmpmeta xmlns:x='adobe:ns:meta/' x:xmptk='Image::ExifTool 11.88'>
<rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'>
<rdf:Description rdf:about='' xmlns:GPano='http://ns.google.com/photos/1.0/panorama/'>
<GPano:CroppedAreaImageHeightPixels>7985</GPano:CroppedAreaImageHeightPixels>
<GPano:CroppedAreaImageWidthPixels>22944</GPano:CroppedAreaImageWidthPixels>
<GPano:CroppedAreaLeftPixels>0</GPano:CroppedAreaLeftPixels>
<GPano:CroppedAreaTopPixels>3487</GPano:CroppedAreaTopPixels>
<GPano:FullPanoHeightPixels>11472</GPano:FullPanoHeightPixels>
<GPano:FullPanoWidthPixels>22944</GPano:FullPanoWidthPixels>
<GPano:ProjectionType>equirectangular</GPano:ProjectionType>
<GPano:SourcePhotosCount>24</GPano:SourcePhotosCount>
<GPano:StitchingSoftware>Hugin</GPano:StitchingSoftware>
<GPano:UsePanoramaViewer>True</GPano:UsePanoramaViewer>
</rdf:Description>
</rdf:RDF>
</x:xmpmeta>
<?xpacket end='w'?>Which currently Pillow resolves to:
{
'RDF': {},
'Description': {'about': ''},
'CroppedAreaImageHeightPixels': {},
'CroppedAreaImageWidthPixels': {},
'CroppedAreaLeftPixels': {},
'CroppedAreaTopPixels': {},
'FullPanoHeightPixels': {},
'FullPanoWidthPixels': {},
'ProjectionType': {},
'SourcePhotosCount': {},
'StitchingSoftware': {},
'UsePanoramaViewer': {},
}You can replicate the above result with:
import types
from PIL.JpegImagePlugin import JpegImageFile
content = b"""<paste XML from above>"""
im = types.SimpleNamespace(_xmp={}, applist=[("APP1", content)])
print(JpegImageFile.getxmp(im))My optimistic expectation would be:
{
"xmpmeta": {
"xmptk": "Image::ExifTool 11.88",
"RDF": {
"Description": {
"about": "",
"CroppedAreaImageHeightPixels": "7985",
"CroppedAreaImageWidthPixels": "22944",
"CroppedAreaLeftPixels": "0",
"CroppedAreaTopPixels": "3487",
"FullPanoHeightPixels": "11472",
"FullPanoWidthPixels": "22944",
"ProjectionType": "equirectangular",
"SourcePhotosCount": "24",
"StitchingSoftware": "Hugin",
"UsePanoramaViewer": "True",
},
},
},
}My environment:
OS: Ubuntu 20.04.2
Python: 3.8.5
Pillow: 8.2.0