How to use getframe without displaying the figure?

Hi,
I am trying to use getframe without displaying the figure. I have read it is impossible because getframe needs the figure to be displayed. So the following code does not work:
figure('visible', 'off')
Do you have any idea how to do that? At least prevent the figure from popping up and display it "behind" the Matlab main window?

2 Comments

Hi,
I tried the following in MATLAB R2015b and R2016a and this worked fine where getframe was able to capture the figure without popping up the figure window.
f = figure('visible', 'off');
plot(rand(5))
F = getframe(gca);
Further to display the captured figure, see below:
figure;
imshow(F.cdata)
Can you share the reproduction code and the version of MATLAB you are working on?
Hi, it works fine. But I noticed it takes 4 TIMES longer when you DON'T VISUALIZE the output. Weird.

Sign in to comment.

Answers (0)

Categories

Find more on Creating, Deleting, and Querying Graphics Objects in Help Center and File Exchange

Asked:

on 5 Apr 2016

Commented:

on 27 Oct 2017

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!