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