I got a number between 0-255 and need to conve开发者_如何学Crt it to a RGB grayscale color. And how do I convert a RGB-color to a grayscale value between 0-255?
The common formula is luminosity = 0.30 * red + 0.59 * green + 0.11 * blue. Matches the human eye's color perception, doesn't otherwise correct for display device gamma.
If you have a number 0 <= x <= 255
representing a grayscale value, the corresponding RGB tuple is simply (x,x,x)
.
精彩评论