-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
AnimGIF not transparent #5656
Labels
Comments
20 tasks
Experimenting, I find that prioritising the global transparency over frame transparency when replacing with background color fixes this. diff --git a/src/PIL/GifImagePlugin.py b/src/PIL/GifImagePlugin.py
index db6944267..128afc428 100644
--- a/src/PIL/GifImagePlugin.py
+++ b/src/PIL/GifImagePlugin.py
@@ -271,11 +271,9 @@ class GifImageFile(ImageFile.ImageFile):
Image._decompression_bomb_check(dispose_size)
# by convention, attempt to use transparency first
- color = (
- frame_transparency
- if frame_transparency is not None
- else self.info.get("background", 0)
- )
+ color = self.info.get("transparency", frame_transparency)
+ if color is None:
+ color = self.info.get("background", 0)
self.dispose = Image.core.fill("P", dispose_size, color)
else:
# replace with previous contents Is the image data that you've provided able to be included as part of our test suite, and distributed under our Pillow license? |
@radarhere |
I've created PR #5756 to resolve this. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The frames of the down below animated GIF are not transparent (first frame works).
Testcase:
The text was updated successfully, but these errors were encountered: