📜  将 rgb 转换为单个值 - Python 代码示例

📅  最后修改于: 2022-03-11 14:46:21.501000             🧑  作者: Mango

代码示例1
# To encode

rgb = red;
rgb = (rgb << 8) + green;
rgb = (rgb << 8) + blue;

# To decode 

red = (rgb >> 16) & 0xFF;
green = (rgb >> 8) & 0xFF;
blue = rgb & 0xFF;