Save PNG images without opening windows for snapshots


Is there a way to save .png images of data files without having to use bst_report('Snapshot','data',...)? Or is there a way to prevent the window from opening when using bst_report('Snapshot','data',...)? This is what I'm doing to save .png images:

for i = 1:length(subjects)
sFiles = bst_process(.....)
sFiles_track{i} = sFiles.FileName;

DataFiles = sFiles_track;
bst_report('Snapshot', 'data', DataFiles, '', []);
report_file_name = 'report_name';
ReportFile = bst_report('Save', sFiles, report_file_name);
image_path = fullfile(path, 'image_name.png');
bst_report('Export', ReportFile, image_path, 'PNG');

Is there a better way of doing this that does not require windows to open that contain the images? In other words, is there a way to save .png images that doesn't use the gui?

Thank you


To be screencaptured the figure has to be visible and at the front.


Indeed, the figures need to be rendered by Matlab in order to make screen captures.
With newer versions of Matlab, the target figure doesn't need to be at the foreground, it can be in the background.

There are other solutions than using bst_report('Snapshot').
You can use the process File > Save snapshot or function out_figure_image.m:

1 Like

Thank you!