RGB to Grayscaler

1. The lightness method averages the most prominent and least prominent colors:

(max(R, G, B) + min(R, G, B)) / 2.

2. The average method simply averages the values: (R + G + B) / 3.

3. The luminosity method is a more sophisticated version of the average method. It also averages the values, but it forms a weighted average to account for human perception. We’re more sensitive to green than other colors, so green is weighted most heavily. The formula for luminosity is 0.21 R + 0.72 G + 0.07 B.


根據不同需求,選擇不同的轉換方式!

原文地址


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章