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

Use transparency when combining P frames from APNGs #8443

Merged
merged 1 commit into from
Oct 6, 2024

Conversation

radarhere
Copy link
Member

Helps #8440

When subsequent frames are loaded from an APNG image, transparency is considered for RGB core images, but not for P core images.

if self.im.mode == "RGB" and "transparency" in self.info:
mask = updated.convert_transparent(
"RGBA", self.info["transparency"]
)
else:
mask = updated.convert("RGBA")

This adds that, modelled after

Pillow/src/PIL/Image.py

Lines 1100 to 1103 in 01bb78a

if isinstance(t, bytes):
self.im.putpalettealphas(t)
elif isinstance(t, int):
self.im.putpalettealpha(t, 0)

@hugovk hugovk merged commit 838e0fb into python-pillow:main Oct 6, 2024
47 of 48 checks passed
@radarhere radarhere deleted the apng_p_transparency branch October 6, 2024 20:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants