Formula to determine brightness of RGB color

前端 未结 20 3393
猫巷女王i
猫巷女王i 2020-11-21 23:16

I\'m looking for some kind of formula or algorithm to determine the brightness of a color given the RGB values. I know it can\'t be as simple as adding the RGB values toget

20条回答
  •  滥情空心
    2020-11-21 23:50

    To add what all the others said:

    All these equations work kinda well in practice, but if you need to be very precise you have to first convert the color to linear color space (apply inverse image-gamma), do the weight average of the primary colors and - if you want to display the color - take the luminance back into the monitor gamma.

    The luminance difference between ingnoring gamma and doing proper gamma is up to 20% in the dark grays.

提交回复
热议问题