What did you do?
Read a GIF file with two or more comments in a single frame
What did you expect to happen?
They would somehow be kept separate in the .info dict
What actually happened?
The comments are run together, e.g. separate comments foo and bar become foobar
What are your OS, Python and Pillow versions?
- OS: Windows 10
- Python: 3.10.4
- Pillow: 9.1.0
Example image:

from PIL import Image
with Image.open("multiple_comments.gif") as im:
print(f'{im.info["comment"]=}')
prints
im.info["comment"]=b'Test comment 1Test comment 2'
I made PR #6294 to address this, that will separate the comments with \r\n.
I admit that such cases are rare, but I have a few found in the wild. Unfortunately most of them have the multiple comments after the last image block, and at present I see no way in Pillow to access comments beyond the last image block. I do have one with 10 comment blocks before the image, a logo from my former employer:

What did you do?
Read a GIF file with two or more comments in a single frame
What did you expect to happen?
They would somehow be kept separate in the
.infodictWhat actually happened?
The comments are run together, e.g. separate comments
fooandbarbecomefoobarWhat are your OS, Python and Pillow versions?
Example image:
prints
I made PR #6294 to address this, that will separate the comments with
\r\n.I admit that such cases are rare, but I have a few found in the wild. Unfortunately most of them have the multiple comments after the last image block, and at present I see no way in Pillow to access comments beyond the last image block. I do have one with 10 comment blocks before the image, a logo from my former employer: