Skip to content

Commit

Permalink
JpegImagePlugin.py fix to resolve issue with xmp meta having trailing…
Browse files Browse the repository at this point in the history
… 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
  • Loading branch information
kerozin authored Sep 22, 2023
1 parent 7a633e3 commit bccc260
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/PIL/JpegImagePlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ def getxmp(self):

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 {}
Expand Down

0 comments on commit bccc260

Please sign in to comment.