Convert a color to grayscale using the luminosity method, which weights each RGB channel according to human brightness perception.
Formula
Gray = 0.2126×R + 0.7152×G + 0.0722×B (luminosity method)