private static int GetGrayValueByMax(int r, int g, int b) { int max = r; max = max > g ? max : g; max = max > b ? max : b; return max; }