Skip to content
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

If first GIF frame has transparency for RGB_ALWAYS loading strategy, use RGBA mode #6592

Merged
merged 1 commit into from Oct 12, 2022

Conversation

radarhere
Copy link
Member

Resolves #6590

At the moment, the first frame of a GIF is never RGBA.

if frame == 0:
if self._frame_palette:
self.mode = (
"RGB" if LOADING_STRATEGY == LoadingStrategy.RGB_ALWAYS else "P"
)
else:
self.mode = "L"

This PR changes it to be RGBA if there is transparency and LoadingStrategy.RGB_ALWAYS is used. In that situation, transparency should not be set in the info dictionary, because the transparency is a palette index, and the image is in RGBA mode.

@radarhere radarhere added the GIF label Sep 17, 2022
@radarhere radarhere changed the title If first frame has transparency for RGB_ALWAYS loading strategy, use RGBA mode If first GIF frame has transparency for RGB_ALWAYS loading strategy, use RGBA mode Sep 17, 2022
@hugovk hugovk merged commit cf3132b into python-pillow:main Oct 12, 2022
@radarhere radarhere deleted the gif_rgba branch October 12, 2022 10:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

First frame of transparent GIF is read incorrectly
2 participants