| Reference | Downloads | Github

Trying to generate two sizes of the same image in random order

If this template helps then use it. If not then just delete and start from scratch.

PsychoPy version 1.84.2
Standard Standalone


I am trying to build an experiment that tests the effect of image size on a rating of that image. The user will be presented with both large images and small images from the same pool. The images will be presented randomly eg. small_image_2, small_image_4, large_image_9, small_image_3, large_image_2 etc. until the user has seen a small and large version of each image.

Currently I have a random loop surrounding the large_image and small_image routines. However the experiment runs like large_image_3, small_image_3, large_image_9, small_image_9, large_image_4, small_image_4 etc. How can I change this to be as I described in the first paragraph ie. truely random?


  1. Your conditions file should just have a single column (containing both large and small image file names).

  2. You should have only one routine, within a single loop. The image component on that routine just displays whatever image is next. The loop will handle randomising these.

Thanks for your reply.

Is there any way to do this using the same files, but changing the size in Psychopy? Otherwise I would have to go through all images and add a border to make them appear smaller. Changing the size of the original file doesn’t work as Psychopy sets the size of the image.

You can set the size of an image the same way you can set most attributes in Psychopy using the $ sign. You would have a column for your image files in your conditions file and a column for the size (default is in normal units - so 1 = full size, 0.25 = quarter size etc).
In the image component you would have $img and $imgSize in the image and size boxes. That way the size would be set on every repeat like the image.

Thanks Oli!

That solved the issue.