Why do calculated and read-out RGB-Values differ? In short:


Generate Mesh and choose color in color picker for the whole mesh (The mesh in the example below is a simple cube)
Read color (three float values) via Python and send them (with mesh details and uv-map ect) to a C++-Application
C++-Application creates a image which should be used as a texture


Problem:

The color, which is shown in the color picker isn't the same as the color of the texture.

I use the three float values, calculate the values between 0 and 255 and set the rgb-channels. Then the image is saved.

Some Screenshots:

color picker with rgb



RGB-Values via GIMP:


R = 184
G = 119 
B = 255


RGB-Values calculated and rounded: (255 * value)


R = 0.479 * 255 = 122
G = 0.184 * 255 = 47
B = 1.0 * 255 = 255


They aren't the same?

Generated Texture



RGB-Values via GIMP:


R = 122
G = 47
B = 255


Renderen with Blender Cycles

And now a Screenshot from the Mesh + Texture rendered via Cycles (with Ambient Occlusion). I removed the default lamp because I wan't to get a clean output.



RGB-Values of the color picker via GIMP (same as above):


R = 184
G = 119
B = 255


RGB-Values of the cube via GIMP:


R = 125
G = 48
B = 255


What is the problem?

PS: I didn't know which tags I should use for this question. So please remove or add tags if you think that would be better. Thanks!
The values differ because the rgb-values of the color picker aren't gamma corrected.
If I correct them like answered here https://stackoverflow.com/a/17910665/3069477 the colors are matching. I still get different RGB-Values but the difference is really small (rounding error).
Resulting Screenshot:

Thanks @someonewithpc!