Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

Save display/canvas as image

edited February 2017 in OpenSesame


I was wondering whether there is a different option than using the print button or an external tool/program to save the stimulus display created in OpenSesame to an image file? I am thinking of something similar to, for instance, pyplots savefig function, so that you can define properties like the format of the picture or maybe even dpi.

I tried what is suggested on psychopy forums:
...but that crashes with:
File "D:\Program Files (x86)\OpenSesame\lib\site-packages\libopensesame\", line 102, in run
File "D:\Program Files (x86)\OpenSesame\lib\site-packages\libopensesame\", line 161, in _exec
exec(bytecode, self._globals)
File "", line 19, in
File "D:\Program Files (x86)\OpenSesame\lib\site-packages\psychopy\visual\", line 798, in getMovieFrame
im = self._getFrame(buffer=buffer)
File "D:\Program Files (x86)\OpenSesame\lib\site-packages\psychopy\visual\", line 820, in _getFrame
im = Image.fromstring(mode='RGBA', size=self.size, data=bufferDat)
File "D:\Program Files (x86)\OpenSesame\lib\site-packages\PIL\", line 2077, in fromstring
"Please call frombytes() instead.")
Exception: fromstring() has been removed. Please call frombytes() instead.

I assume some critical module is not up-to-date (I was running the script on the psychopy backend)?
Is there maybe another alternative?



  • Hi Michel,

    Wouldn't it suffice to just log all the parameters that determine what the screen will look like?

    If not, then there's python code to just save a printscreen to a file, see for instance this topic on another forum:

    You could place similar code in an inline script, placed right after your sketchpad for instance.



  • Making a canvas function (a la is also on our to-do list. However, it is not finished yet. Daniel started to implement this. Maybe the current version is already useful to you:


  • Thanks for pointing that out Eduard. I indeed started working on such a function, but never got around to really implementing it. The example function should provide a good start and should work out of the box, although newer versions of OS might have some changes that break the function.

Sign In or Register to comment.