psychopy.org | Reference | Downloads | Github

Image pixelated

Hello

I drew some simple emoticons (primarily circles) in CorelDraw and stored them as .png, .tiff, .eps etc. and tried to present them in PsychoPy. However, images are pixelated. I have the newest version of PsychoPy and screen resolution is max.I also set interpolation on/off and also increased dpi up to 1000.

I don´t know what I can do else.
Thank you very much!
Best,
M

First the most obvious thing: are the actual images you import in psychopy pixilated? Try viewing them with your image viewer. Just to make sure they’re not 10x10 pixels or so.

If this is not the problem, could you update your question with a screenshot of the pixilated images and attach an image file? Do you change the size of the image component during the experiment?

Hi lindeloev,

Thank you for the response!
Pictures are in good quality when I saved them in CorelDraw (see attachment).
Regarding change of the image size. I tried the standard parameters in PsychoPy (size[0.5, 0.5]) and I made
them bigger (e.g. size[2,2]), but the result was always the same…

.

I do not know of a good solution here. It has to do with how GL and the graphics card scales images. Perhaps @jon has an idea?

In the meantime, an ugly hack would be to scale down the images outside of psychopy to approximately the size that they’re going to be presented and use that image file in your experiment.

I think you might just be asking too much - you’re trying to draw lines that are super-thin, like about the width of a pixel and you’re wanting them to curve smoothly. I’m not sure it’s really possible, but certainly it will depend on the resampling/interpolation as the image gets shrunk and we only have a little control over that from within OpenGL. @lindeloev’s solution of resizing your image in your graphics program, to the actual size you want in pixels, is the right way to go

I did try to resize the images using a regular image editor (GIMP) and it does look more smooth-circle like there than what GL does. The only solution I can think if is to use PIL or some other image manipulation library to scale the image in python, once you’ve determined the resolution that you to present it in.

Something like

from psychopy import visual
win = visual.Window()

from PIL import Image
pic = Image.open('fancy_goat.png')
pic.resize((100, 100), 'ANTIALIAS')  # desired size in pixels or convert.
# somehow get pic into visual.ImageStim(win, image=xxxxxxx) here

You can convert using these functions in psychopy.