You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Calling set_opacity(1) on an image with a transparent background causes that background to become black.
That is because set_opacity incorrectly overwrites the transparency of the image.
Expected behavior
When calling set_opacity(x) the opacity of any given pixel in the image should be x*y where y is the alpha channel of the original unmodified image. Especially any pixel that was fully transparent in the original image should remain transparent no matter how the opacity is modified
How to reproduce the issue
Code for reproducing the problem
config.background_color=WHITEclassOpacityBug(Scene):
defconstruct(self):
image=ImageMobject("Image with Transparent Background.png")
# The background is displayed correctlyself.add(image)
self.wait(1)
image.set_opacity(1)
# The background is now a black boxself.wait(1)
While this example is quite artificially constructed any change to the opacity will cause this issue e.g. Animations that change transparency
Additional media files
Images/GIFs
System specifications
System Details
OS (with version, e.g., Windows 10 v2004 or macOS 10.15 (Catalina)): Linux Mint 21.3
Uh oh!
There was an error while loading. Please reload this page.
Description of bug / unexpected behavior
Calling set_opacity(1) on an image with a transparent background causes that background to become black.
That is because set_opacity incorrectly overwrites the transparency of the image.
Expected behavior
When calling set_opacity(x) the opacity of any given pixel in the image should be x*y where y is the alpha channel of the original unmodified image. Especially any pixel that was fully transparent in the original image should remain transparent no matter how the opacity is modified
How to reproduce the issue
Code for reproducing the problem
While this example is quite artificially constructed any change to the opacity will cause this issue e.g. Animations that change transparency
Additional media files
Images/GIFs
System specifications
System Details
pip list
):The text was updated successfully, but these errors were encountered: