算法1:

Gray = (Red + Green + Blue) / 3

算法2:

Gray = (Red * 0.3 + Green * 0.59 + Blue * 0.11)

上半部分算法1,下半部分算法2

算法3:

( Math.max(Red, Green, Blue) + Math.min(Red, Green, Blue) ) / 2

算法4:

Math.max(Red, Green, Blue)

Math.min(Red, Green, Blue)

算法5:

Gray = Red

Gray = Green

Gray = Blue

算法6:

ConversionFactor = 255 / (NumberOfShades - 1)
AverageValue = (Red + Green + Blue) / 3
Gray = Math.round((AverageValue / ConversionFactor) + 0.5) * ConversionFactor

4 shades

16 shades