-
-
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
Added has_transparency_data #7420
Conversation
Hi @radarhere – thanks for this PR! My only question was going to be whether image palettes support modes other than RGBA, but you've addressed that in your comments to @homm, so from my perspective (of admittedly limited experience), I think it looks great. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could also be a property, any preference?
Co-authored-by: Hugo van Kemenade <[email protected]>
Sure, that seems like a reasonable idea. I've added a commit to change it to a property. |
faea2bb
to
e27d7a6
Compare
Looks good, let's also add to the release notes. |
Sure, I've pushed a commit for that. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
Resolves #7384
Adds a method to determine if an image has transparency data - an alpha channel, an RGBA palette or "transparency" in the image's
info
directory.I chose this method name to try and indicate that the image may still be opaque. For example,
hopper("RGB").convert("RGBA")
has an alpha channel, but has no transparent or translucent pixels.In doing so, I found a similar check in WebPImagePlugin.
Pillow/src/PIL/WebPImagePlugin.py
Lines 335 to 340 in b723e9e
So I've changed that to use this new method.