New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Only write GIF comments at the beginning of the file #6300
Only write GIF comments at the beginning of the file #6300
Conversation
Place GIF comment after Global Color table. Should go after "NETSCAPE" looping extension after pull #6211.
for more information, see https://pre-commit.ci
Changed to use a test image already in Images folder
I updated the tests to use |
Once comment is loaded, keep it for subsequent frames
@radarhere I am fine with your changes to this. Thanks. |
https://github.com/raygard/Pillow/pull/2 keeps the last comment read in With that change, the following code also works before and after this PR, helping backwards compatibility. from PIL import Image
im = Image.new("RGB", (1, 1))
im2 = Image.new("RGB", (1, 1), "#f00")
im.save("out.gif", save_all=True, append_images=[im2], comment=b"comment")
reloaded = Image.open("out.gif")
reloaded.seek(1)
assert reloaded.info["comment"] == b"comment" |
Helps #6207
Place GIF comment after Global Color table. Should go after "NETSCAPE" looping extension after pull #6211.
Fixes #6299.
Changes proposed in this pull request:
_write_local_header()
to_get_global_header()
test_write_comment()
to validate that a comment is written to the first frame onlytest_write_no_comment()
to validate that an emptycomment=""
arg to.save
leaves no comments in saved filemultiple_comments.gif
added in PR Separate multiple GIF comment blocks with newlines #6294 but could use any animated GIF instead — CHANGED todispose_prev.gif’
The change here to
_get_global_header()
overlaps the change in PR #6211. Please be sure the merge is done so that theif "comment" in info and len(info["comment"]):
code in this PR is placed after theif "loop" in info:
code in PR #6211. The comment must come after the "NETSCAPE2.0" block.