Colour jpg images

OS : masOS catalina
PsychoPy version : 2020.2.6
Standard Standalone? (y/n) If not then what?:
What are you trying to achieve?:
I would like to colour the foreground or background of some jpg. images with a colour randomly selected from a RGB colour space. Can I know how can I do it in psychoPy? Thanks in advance!

Non coding solution > just create a lot of different image yourself with different foreground/background colour, feed them to psychopy using and excel file and a loop and let the program manage the randomized presentation of these stimuli.

Coding solution > I am not sure that what you want to do can be done in psychopy :thinking:
For example, you could “recreate” the image in the example using different polygon components and then use a code component to randomly colour the foreground/background, BUT you’ll have to re-create each image and more complex images would be rather challenging to adapt.

tandy

Thanks, Tandy! Yes, I would like to recreate those pictures. I would like to use a code component to randomly colour the foreground/background of different images with an irregular shape in it.

Then you should be able to recreate them with different polygon components. I’m sure there is also a way to randomly selecting a fill colour using a code component. I think you should start with recreating the images and work from there.