psychopy.org | Reference | Downloads | Github

RGB colour space limits differ in visual.ImageStim

In the psychopy documentation, it states that RGB values vary between -1 to 1.
https://www.psychopy.org/general/colours.html
I find this to work well when creating a psychopy.visual.Rect or visual.ImageStim when the colour is specified in ImageStim.Color.

However, when I load a numpy array (with rgb values ranging -1 to 1) and display it using visual.ImageStim(image=rgbarray), the colours appear distorted/saturated. Furthermore, if I convert the rgb values to range between 0-1 then it displays normally again, contrary to psychopy documentation.

Finally, if I display the np.array Image using Visual.GratingStim(tex=rgbarray), (rgb values varying between -1 and 1), then the image displays normally again. Is this a bug or have I done something wrong?

Thanks,
Mubaraka

Hi Mubaraka,

I am having the same problems you reported in your original post - did you manage to resolve the colour issues in ImageStim? I’ve tried both different colour arguments in ImageStim and GratingStim - only the latter works with values in numpy arrays -1:1

Any thoughts / advice, gratefully received!

Doug.