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
{{ message }}
Repository navigation
ImagePalette: loading a translucent RGBA color into an RGB palette will break the palette #6652
And then, this color is consumed in line 151, always assuming it is 3-bytes long (and having 4 would make colors from that point on "out of sync") . I was about to send a small PR raising value error in the unchecked case:
For context, the code to handle opaque RGBA colors was added in #5552.
I think that raising a ValueError is the better solution. If Pillow just accepted the input, this could surprise the user later when they discover that the RGBA color isn't really there.
The error you're hitting is when the tests try to set an RGBA value for a P image. The test was changed to use a translucent value in #6504, which was a PR about allowing RGB and RGBA values for PA images. Setting a translucent value for a P image was a side-effect, not the intention. So I'm happy to change the test.
Activity
radarhere commentedon Oct 9, 2022
For context, the code to handle opaque RGBA colors was added in #5552.
I think that raising a ValueError is the better solution. If Pillow just accepted the input, this could surprise the user later when they discover that the RGBA color isn't really there.
Fix python-pillow#6652: Handle translucent color used in RGB ImagePal…
jsbueno commentedon Oct 9, 2022
Oh, -
i did the ValueError thing - but it looks like event he code in texts expect to be able to insert translucent colors,
and get the alpha rounded.
So - do we use the RGB components?
Or should the failing tests be changed?
radarhere commentedon Oct 10, 2022
The error you're hitting is when the tests try to set an RGBA value for a P image. The test was changed to use a translucent value in #6504, which was a PR about allowing RGB and RGBA values for PA images. Setting a translucent value for a P image was a side-effect, not the intention. So I'm happy to change the test.
I've created jsbueno#2