I’m working on a simple image presentation experiment. However, all the images I received to display are quite different sizes. I’d like to get them to display as full screen as possible, with no cropping. That is, it will always scale until it hits a border (e.g. wide images will have extra borders only at the top, and high images will have borders on the sides).
How could I check the size of the image before loading it with ImageStim and only scale to the ratio of the screen size and image size on its longest dimension?
It looks like you’d need to import PIL, load the image, retrieve the height and width values, divide this by the screen size and then use the product of this and the screen size as your size variable in your imageStim… might be easier to just resize the images so they are a standard size!
if you use imageStim to open the image from the file without using the size parameter, then the value inside the variable size is from your image. So for myImage it is myImage.size and is a list with the x and y values. You can then use that info to change the size to what you need. Hope this helps.