psychopy.org | Reference | Downloads | Github

RGB (0:1) to PsychoPy RGB (-1:1)

For an experiment I’m running in PsychoPy 2.3, I have a matrix of normalized RGB (sRGB) values that represent a color wheel. It seems that there is no way of setting the default color-space to normalized RGB, even when manually typing it in the coder, so I resort to asking - is there a function that scales normalized RGB values to PsychoPy RGB?
Since I’m not familiar with this color space, I’m not sure what the conversion formula is…

Thanks in advance! :smiley:

Multiplying each value by 2 and subtracting 1 should work

1 Like

Wakefield’s solution will work in any version as that’s all the difference between those color spaces is :slight_smile:

However, in 2021.2.0 or newer, you can set the color space of a stimulus to be 'rgb1' and all this will be done for you. You could also use:

colors.Color(value, 'rgb1').rgb

to get the value in PsychoPy’s RGB(-1:1) color space.

3 Likes