JpegImagePlugin.py fix to resolve issue with xmp meta having trailing 0x00 byte

I faced the issue with files having trailing 0x00 in xmp meta information. The files was originally generated with Canon Digital Photo Professional and later edited in MacOs Preview to add image description to the meta information. I haven't investigated which program exactly added trailing zero byte but fix is dealing with it fine
This commit is contained in:
dennis 2023-09-22 13:30:20 +08:00 committed by GitHub
parent 7a633e3500
commit bccc26057d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -496,7 +496,7 @@ class JpegImageFile(ImageFile.ImageFile):
for segment, content in self.applist:
if segment == "APP1":
marker, xmp_tags = content.rsplit(b"\x00", 1)
marker, xmp_tags = content.strip(b"\x00").rsplit(b"\x00", 1)
if marker == b"http://ns.adobe.com/xap/1.0/":
return self._getxmp(xmp_tags)
return {}