psychopy.org | Reference | Downloads | Github

Consistent image size across screens

URL of experiment: https://run.pavlovia.org/aelreym/concurrent_schedule_task/html

Description of the problem:
In the routine “cigarette length” I ask participants to estimate the real length of a cigarette by clicking on the appropriate image. So I have images of cigarettes with the real length of cigarettes and some deviations.
In my builder experiment I have set the units of my images to “cm” but this doesn’t work online. I have changed it to “from exp settings” and this does adapt the sizes to the screen and changes the dimensions of the cigarettes across screens. Is there a way to have consistent image sizes across screens?

2 Likes

Ah, that’s a tricky one. When you select a unit like “cm”, you need to have a defined monitor. That is, PsychoPy needs to know both the resolution of your screen and its physical dimensions. It is actually impossible to get this information for participants on Pavlovia, or really any other web-based system. You can get the resolution easily enough, but physical dimensions are not readable. So, unfortunately, you won’t be able to get consistent sizing across different screens unless each one has its monitor information entered into PsychoPy, and it’s simply not possible to do over Pavlovia at all.

Thanks for the explanations, I will try to replace this routine by something else.

It is actually possible to ask participants for the screen dimensions. The standard procedure is to ask them to resize a rectangle on the screen until it is the same size as an object we know the dimensions of (eg. credit card). jsPsych has a built-in plugin for this: https://www.jspsych.org/plugins/jspsych-resize/

Psychopy could implement a helper method that does the same

The trick would be to use the helper method to then feed into the units system, but that’s a good thought. That said, I don’t think @jon and the other developers have a huge amount of time to devote to new features right now, but worth putting in a feature request for in the issues queue on github.

Yeah, I created an issue on github. Thanks for the suggestion.

Yes, it’s worth having the to-do list ready. At some point we will be getting back to feature development! In fact, a new programmer will be starting on 1st June to work on PsychoJS full-time which will hopefully make a big difference to what we can achieve! :slight_smile:

1 Like

Hi, what is the trick to get the resolution ?

Javascript has very simple tools for this that are built-in and so can be incorporated into a PsychoPy code component (in principle). See here: https://www.tutorialrepublic.com/faq/how-to-detect-screen-resolution-with-javascript.php

Thanks for the info. How might this be implemented in PsychoPy though? More specifically, how can I use these Javascript screen.width and screen.height values in Python code/fields e.g., width and height of an image object?

The best solution would probably be to set the width and height to variable names rather than values, and then define those variables in a code component in either begin routine or begin experiment in terms of the screen width and height.

However, in general terms, if you want your stimulus displays to be relative to the screen size, you could use norm or height units, which should adjust for screen resolution automatically.

You can use my Screen Scale routine. It uses a credit card and then displays a square using height or norm units.

2 Likes