1

I'm writing in Python but I'm sure other languages have the same approach.

I'm coding a tool for a 3D Software (Softimage) and the SDK manual doesn't specify anything about how I need to specify the color and I got to this conclusion just by trial and error looking for some codes in the internet.

The color needed to be specified with an integer number which I get it like this:

With colors in 0-255 values:

Rvalue | Gvalue << 8 | Bvalue << 16 | Avalue << 24

It seems to work perfectly, now I'd like to convert this integer number back to RGBA values. How should I proceed ?

Mahir Islam
  • 1,941
  • 2
  • 12
  • 33
furikake
  • 33
  • 5
  • 3
    Possible duplicate of [convert Integers to RGB values and back with Python](https://stackoverflow.com/questions/33124347/convert-integers-to-rgb-values-and-back-with-python) – YSelf Jul 24 '18 at 09:59

1 Answers1

0
R = color & 255
G = (color >> 8) & 255
B = (color >> 16) & 255
A = (color >> 24) & 255
memo
  • 1,868
  • 11
  • 19