You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Opened an animated GIF, wrote it out with a comment= argument to .save.
What did you expect to happen?
I expected the comment to be written once, preferably at the beginning of the file, per advice in (GIF89a spec)[https://www.w3.org/Graphics/GIF/spec-gif89a.txt]
it is recommended that Comment Extensions do not interfere with Control or Data blocks; they should be located at the beginning or at the end of the Data Stream to the extent possible.
Pillow's handling of GIF comments needs to be changed. A comment can be specified with comment="..." arg to .save() or by putting a comment in the .info dict of the Image object being saved. It is now being written in every frame, and placed after the Graphic Control Extension block (if one is written) and before the Image Descriptor. The placement is not prohibited by the standard, but is contrary to the "Recommendations" in part 24e of the standard and also to the GIF Grammar in Appendix B.
I have written PR #6300 to resolve this. It will write the comment once only, before the first Graphic Control Block (if any) and the first Image Descriptor. After PR #6211 is merged, this should cause the comment to appear just after the "NETSCAPE2.0" looping control block, if one is written.
The text was updated successfully, but these errors were encountered:
What did you do?
Opened an animated GIF, wrote it out with a
comment=
argument to.save
.What did you expect to happen?
I expected the comment to be written once, preferably at the beginning of the file, per advice in (GIF89a spec)[https://www.w3.org/Graphics/GIF/spec-gif89a.txt]
What actually happened?
The comment was repeated in every frame.
What are your OS, Python and Pillow versions?
Output with 9.1.0:
Discussion:
Pillow's handling of GIF comments needs to be changed. A comment can be specified with
comment="..."
arg to.save()
or by putting a comment in the.info
dict of the Image object being saved. It is now being written in every frame, and placed after the Graphic Control Extension block (if one is written) and before the Image Descriptor. The placement is not prohibited by the standard, but is contrary to the "Recommendations" in part 24e of the standard and also to the GIF Grammar in Appendix B.I have written PR #6300 to resolve this. It will write the comment once only, before the first Graphic Control Block (if any) and the first Image Descriptor. After PR #6211 is merged, this should cause the comment to appear just after the "NETSCAPE2.0" looping control block, if one is written.
The text was updated successfully, but these errors were encountered: