We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Ran the GIF tests in Pillow-9.1.0, looked at output from test_comment_over_255(tmp_path) test.
test_comment_over_255(tmp_path)
The output GIF file should be GIF89a because it contains a comment.
The file temp.gif has a signature of GIF87a.
For code, see def test_comment_over_255(tmp_path): in Tests\test_file_gif.py.
def test_comment_over_255(tmp_path):
Tests\test_file_gif.py
The generated image file is:
Discussion:
This is due to an obsolete line in _get_global_header(im, info) in GifImagePlugin.py:
_get_global_header(im, info)
GifImagePlugin.py
extensionKey == "comment" and not (1 <= len(info[extensionKey]) <= 255)
The len(info[extensionKey]) should be simply tested for 0 to indicate no comment is wanted. Suggested change is
len(info[extensionKey])
extensionKey == "comment" and len(info[extensionKey]) == 0
I have created a pull request #6292 for this.
As a side note, I think the entire feature test for GIF 87a vs. 89a can be changed from:
version = b"87a" for extensionKey in ["transparency", "duration", "loop", "comment"]: if info and extensionKey in info: if (extensionKey == "duration" and info[extensionKey] == 0) or ( extensionKey == "comment" and len(info[extensionKey]) == 0 ): continue version = b"89a" break else: if im.info.get("version") == b"89a": version = b"89a"
to:
version = b"87a" if (im.info.get("version") == b"89a") or info and ( "transparency" in info or "loop" in info or ("duration" in info and info["duration"] != 0) or ("comment" in info and len(info["comment"]) != 0)): version = b"89a"
I think that's correct but would be happy for someone to look it over.
The text was updated successfully, but these errors were encountered:
https://www.w3.org/Graphics/GIF/spec-gif89a.txt
Comment Extension. ... b. Required Version. 89a.
You're right, thanks for catching that.
Sorry, something went wrong.
Successfully merging a pull request may close this issue.
What did you do?
Ran the GIF tests in Pillow-9.1.0, looked at output from
test_comment_over_255(tmp_path)
test.What did you expect to happen?
The output GIF file should be GIF89a because it contains a comment.
What actually happened?
The file temp.gif has a signature of GIF87a.
What are your OS, Python and Pillow versions?
For code, see
def test_comment_over_255(tmp_path):
inTests\test_file_gif.py
.The generated image file is:
Discussion:
This is due to an obsolete line in
_get_global_header(im, info)
inGifImagePlugin.py
:The
len(info[extensionKey])
should be simply tested for 0 to indicate no comment is wanted.Suggested change is
I have created a pull request #6292 for this.
As a side note, I think the entire feature test for GIF 87a vs. 89a can be changed from:
to:
I think that's correct but would be happy for someone to look it over.
The text was updated successfully, but these errors were encountered: