diff --git a/Tests/test_image.py b/Tests/test_image.py
index 14a067127..ac358f5bf 100644
--- a/Tests/test_image.py
+++ b/Tests/test_image.py
@@ -989,7 +989,7 @@ class TestImage:
im = Image.new("RGB", (1, 1))
im.info["xmp"] = (
b'\n'
- b'\n\x00\x00'
+ b'\n\x00\x00 '
)
if ElementTree is None:
with pytest.warns(
diff --git a/src/PIL/Image.py b/src/PIL/Image.py
index ed2f728aa..e03e9cc8a 100644
--- a/src/PIL/Image.py
+++ b/src/PIL/Image.py
@@ -1511,7 +1511,7 @@ class Image:
return {}
if "xmp" not in self.info:
return {}
- root = ElementTree.fromstring(self.info["xmp"].rstrip(b"\x00"))
+ root = ElementTree.fromstring(self.info["xmp"].rstrip(b"\x00 "))
return {get_name(root.tag): get_value(root)}
def getexif(self) -> Exif: