Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # rgb2int_reverse.py -- white (255,255,255) = 16777215
- def rgb2int(rgb):
- return rgb[0] * (256**2) + rgb[1] * 256 + rgb[2]
- def int2rgb(dd):
- return (dd // 256 // 256 % 256, dd // 256 % 256, dd % 256)
- print rgb2int([0,255,255])
- print int2rgb(65535)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement