Skip to content

image/color: when color.ModelFunc.Convert,it seems no need pre rendering #5854

@gopherbot

Description

@gopherbot

by augustheart:

I found these code at "func nrgbaModel(c Color) Color" and "func
nrgba64Model(c Color) Color" in "image/color"
"
    // Since Color.RGBA returns a alpha-premultiplied color, we should have r <= a && g <= a && b <= a.
    r = (r * 0xffff) / a
    g = (g * 0xffff) / a
    b = (b * 0xffff) / a
"
It seems no need for precess a image.And when we process a paletted png,these code will
distory the palette.
example:
    f,_ := os.Open("sample.png")
    defer f.Close()
    img,_ := png.Decode(f)
    out,_ := os.Create("result.png")
    defer out.Close()
    png.Encode(out,img)
If the sample.png is a paletted png with alpha,these code will generate a different pLTE

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions