| Reference | Downloads | Github

Is the rgb255 colorspace ever going to be added to Builder?


OS (e.g. Win10): OSX/Win10
PsychoPy version (e.g. 1.84.x): 1.9, 3.0

Hi All,

This is my first post so please excuse any noob errors.

I teach vision and psychophysics and have developed a suite of experiments that implement the standard Fechnerian threshold methods (Adjustment, Limits, Constant Stimuli). The experiments measure the luminance JND for a gray spot on a gray background.

In the builder, the choices of color space for the spot/background are rgb, dkl, lms, and hsv. These are all normalized to allow floating point color calculations, but this also means that due to precision/rounding errors one never really knows the exact digital counts (RGB 0-255 values) that get sent to the display (which is crucial for measuring the threshold).

To get around this, after I made the experiments in Builder I went in and edited the Python code to change the colorspace for the critical elements to ‘rgb255’ and then implemented a simple form of “bitstealing”. This seems to work well, but it makes it so that the modified code/experiment can no longer be worked on in / run from Builder (not so good for my students)

So to make a long question short: Is there any plan to add the ‘rgb255’ colorspace to Builder?

If this is something I can do by editing some config file I would be happy to learn about it. If not then I would like to add this request to changes to the next build.

Awesome project!!! Thanks to all developers!!!

-Jim Ferwerda


Hi Jim?

Have you found any answer to your request yet?
It would also be fantastic for my experiment to add the ‘rgb255’ colorspace as a code component. I’ve built an interleaved staircase to measure a contrast sensitivity threshold but (1) my background is [120,120,120] in ‘rgb255’ colorspace which corresponds to [-0.059,-0.059,-0.059] in ‘rgb’ colorspace, (2) I would like to have a stimulus that is darker than the background. Then it will have a negative value in rgb colorspace (e.g; a dark grey [-0.471,-0.471,-0.471] in ‘rgb’ equals to a [70,70,70] dark grey in ‘rgb255’). Because of these negative values, I cannot use the db stepsize used by default in the interleaved staircase and the color of my stim can not be adapted correctly.
Thanks for your help,


Hi Laura,

I don’t know if it helps with your problem, but I see that PsychoPy 3.0 now includes the ‘rgb255’ colorspace as a choice for polygon objects (but not for gratings, noise patterns, and the like). This solves my problem since I was just making spot-on-background stimuli, but it may not solve your problem. I would like to see rgb255 available throughout PsychoPy since I’m a bit concerned about the quantization/clipping/rounding/etc. that occurs in the graphics pipeline from specification (e.g. 0-1 floating point) to actual display (e.g. 0-255 integer). For example, I developed a contrast threshold experiment for my intro psychophysics course and found that even though PsychoPy was perfectly happy to report that the JND was 0.43 (rgb) there was no meaning to this because the measured light output from the display wasn’t actually changing. I got around this by implementing a cheap form of “bitstealing" (changing individual RGB values by 1 in a “grayscale” image to get smaller luminance steps, see the paper by Stan Klein) but this may not work in general.

Hope this helps. Good luck,