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

image/color: Palette ignores alpha channel #9902

magical opened this issue Feb 17, 2015 · 0 comments

image/color: Palette ignores alpha channel #9902

magical opened this issue Feb 17, 2015 · 0 comments


Copy link

@magical magical commented Feb 17, 2015

Palette.Index, and by extension image.Paletted.Set, cannot distinguish between image.Black and image.Transparent (and in general, any fully-transparent color or partially-transparent black) because it ignores the alpha channel of the colors when searching for the closet match.

This makes it impossible to draw a black pixel onto an image.Paletted whose palette contains color.Transparent, even if it also contains color.Black (or the other way around, depending on the order of the colors in the palette).

See this example program:

In general, it seems like p.Convert(c) should equal c, for every color.Palette p and color.Color c in p.

@rsc rsc added this to the Go1.5Maybe milestone Apr 10, 2015
@nigeltao nigeltao closed this in 28388c4 Apr 16, 2015
@mikioh mikioh added this to the Go1.5 milestone May 27, 2015
@mikioh mikioh removed this from the Go1.5Maybe milestone May 27, 2015
@golang golang locked and limited conversation to collaborators Jun 25, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants