Search
 
SCRIPT & CODE EXAMPLE
 

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;
Comment

PREVIOUS NEXT
Code Example
Python :: pandas check if column is sorted 
Python :: or in django query 
Python :: Calculate Euclidean Distance in Python using distance.euclidean() 
Python :: How to loop over grouped Pandas dataframe? 
Python :: takes 1 positional argument but 2 were given python 
Python :: openai python 
Python :: append dictionary to list python 
Python :: how to get time in python 
Python :: give a function a name python 
Python :: matplotlib log scale y axis base 
Python :: finding factorial of a number in python 
Python :: python for loop get iteration number 
Python :: python grouped bar chart 
Python :: generate dates between two dates python 
Python :: python edit global variable in function 
Python :: django render template 
Python :: isinstance python 
Python :: pandas dataframe replace inf 
Python :: python create a pinging sound 
Python :: python open file for reading and writing 
Python :: how to count how many cameras you have with python 
Python :: how to change index date format pandas 
Python :: fasttext python 
Python :: how to run python program in sublime text 3 windows 
Python :: django prefetch_related vs select_related 
Python :: python turtle triangle 
Python :: python 3.8.5 download 32 bit 
Python :: python optional arguments 
Python :: how to make python open a program/desktop app 
Python :: deep copy a dataframe 
ADD CONTENT
Topic
Content
Source link
Name
7+4 =