Is the Go png encoder performing gamma correction ?

101 views
Skip to first unread message

christoph...@gmail.com

unread,
Mar 30, 2021, 8:19:57 AM3/30/21
to golang-nuts

It is unspecified in the documentation if the png encoder is performing gamma correction. I thus assume that it is not performing gamma correction. Is this assumption correct ?

According to wikipedia, jpg images are gamma encoded. What is the status of png images ? It seam relevant for antialiasing, especially for font rendering.

ma...@eliasnaur.com

unread,
Mar 30, 2021, 8:59:00 AM3/30/21
to golang-nuts
On Tuesday, 30 March 2021 at 14:19:57 UTC+2 christoph...@gmail.com wrote:

It is unspecified in the documentation if the png encoder is performing gamma correction. I thus assume that it is not performing gamma correction. Is this assumption correct ?

According to wikipedia, jpg images are gamma encoded. What is the status of png images ? It seam relevant for antialiasing, especially for font rendering.


I haven't looked, but I expect the png package to just encode the pixels given to it. sRGB with gamma around 2.2 is the usual colorspace for 8-bit color components, but that doesn't matter for lossless encoding or decoding color values.

The color space *does* matter for composing images, see https://github.com/golang/go/issues/11420 about the issue that the x/image/draw package operates in linear RGB.

Elias
Reply all
Reply to author
Forward
0 new messages