Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

convert rgb to a single value

# 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;
 
PREVIOUS NEXT
Tagged: #convert #rgb #single
ADD COMMENT
Topic
Name
5+5 =