Hello everyone,
I’m coding my experiment using PsychoPy v1.85.6 in a MacOS High Sierra v10.13.6 .
I’m using ImageStim to draw some images (.png) using degrees of visual angle. The problem is that when I try to rescale the images they lose quality (see snapshots attached).
Here is an example code:
# define parameters
refresh_rate = 60
mon_size = [1920, 1200]
mon_width = 53.1
mon_distance = 60
# define monitor
my_monitor = monitors.Monitor('testMonitor',
width=mon_width,
distance=mon_distance)
# create window
win = visual.Window(monitor=my_monitor,
units='deg',
size=mon_size,
fullscr=True,
allowGUI=False)
# create stimuli
panel = visual.ImageStim(win,
image='/somepath/Slide-01.jpg',
units='deg')
# resize stimuli
panel.size /= 1.5
# draw stimuli
for i in range(144):
panel.draw()
win.flip()
When leaving size of images untouched, or when resizing images manually outside of PsychoPy, they don’t lose resolution.
Perhaps there is something wrong in my code that you can help me with?
I’ve tried converting the images to different formats (.png .jpg .tiff .bmp), but results remained the same. I’ve also tried using .eps but got an error saying that the file didn’t exist (while I’m sure the file was in the path indicated).
I’ve also tried rescaling the images using:
panel = visual.ImageStim(win,
image='/somepath/Slide-01.jpg',
units='deg',
size=[25,30])
…but images still lose quality.
This is an example of the original image (dimensions = 886 × 903):
This is an example of the image presented without resizing:
And this is an example of the pixelated image when resizing:
Thank you!