# Different sized stimuli need to appear in the same location

I’m new to PsychoPy (I’ve used SR Research’s Experiment Builder and OpenSesame in the past, but my university has just decided to switch to PsychoPy/Pavlovia for the current time).

I’m trying to recreate an experiment I’ve successfully created in both Experiment Builder and OpenSesame, and one of the first things I need to do is to display my images during a trial. A trial consists of 2 images stacked on top of each other (background image and foreground image). The foreground images are all different sizes, but they need to appear at the same location on the background image (i.e. the top-left corner of the foreground image needs to be in the same spot each time, regardless of the size of the foreground image).

Currently the image moves based on the center of the image (I believe) and the center of the screen, but I need this to change. Also, since the foreground images are different sizes, I’ve changed the units to pixels for this display (so they appear as actual size, since I don’t know how to make them appear at actual size otherwise).

If someone could help, it would be much appreciated!

TLDR; 2 problems: 1. can images be moved based on top-left coordinates, not center? 2. how to show different size images as actual size on one display.

You could set the ImageStim units to ‘pix’ and save the size of your images in pixels `(w, h)` as a variable with the path of your image in your conditions file. Then, setting the left top is just a matter of subtraction from the center and you could set the size for every picture.

This is just simple geometry. The top-left of the image is displaced relative to the centre of the image by half the image’s width and height. So if you have two variables `x` and `y` that represent the coordinates of the top left corner, then set the position of the image like this:

``````[x + 0.5 * your_stimulus.pos[0], y - 0.5 * your_stimulus.pos[1])
``````

I’m not really sure what that means. Can you explain more, with a detailed example?

I’m thinking that the above suggestion of putting the pixel dimensions in the conditions file is probably the easiest way to get this done. My only concern with this is that I’m planning on running the experiment online with Pavlovia. Would it be better to size the pictures by pixel (so they’re identical) or to do this in a different unit (i.e. normalized units)?

In terms of your last question (different size images), I’ve included 2 pictures with examples. The background of each picture is the same (the gmail interface), but the picture on top is different (the physical email shown) (the first picture is 928x385 pixels and the second is 399x506 pixels).

I need the images to look exactly like this in the experiment (the email needs to be in the same location on top of the gmail interface), whatever monitor they’re displayed on. I’m not sure if measuring by pixels is the best way to do this since I can’t control everyone’s monitor size or resolution.