I am not sure if this is expected behaviour, but on macOS
Screen(‘GetImage’, window)
Gives the Psychtoolbox startup window with the frog, regardless of what is on the screen. Specifying the back or draw buffer results in expected behaviour i.e. capturing what is displayed. Thus is seems to be an issue with capturing the front buffer.
I am running Tahoe 26.5, but if my memory is correct, seem to remember having discovered this prior to Tahoe (but failing to report it).
I have not tested it on other operating systems as far as I can remember.
The code below will reproduce the possible error
Peter
*****
% Clear the workspace and the screen
sca;
close all;
clear;
% Here we call some default settings for setting up Psychtoolbox
PsychDefaultSetup(2);
% Get the screen numbers
screens = Screen(‘Screens’);
% Draw to the external screen if available
screenNumber = max(screens);
% Open an on screen window
[window, windowRect] = PsychImaging(‘OpenWindow’, screenNumber, [rand rand rand]);
% Flip to the screen
Screen(‘Flip’, window);
% Capture the screen image
imageArray = Screen(‘GetImage’, window, [], ‘FrontBuffer’);
imwrite(imageArray, [cd ‘/exampleCapture.jpeg’])
% Clear the screen
sca;
*****