Hi,
I'm using imwrite to save images on a machine that I'm accessing via remote desktop. This works as expected when the remote desktop screen is maximised. However, if I minimise or close the remote desktop to get on with something else while it's processing, I just end up with blank images.
This is the code I'm using:
def_back = get(gcf,'Color');
set(gcf,'Color',[1 1 1]);
drawnow
frame = getframe(gcf);
image = (frame2im(frame));
imwrite(image,[<FILENAME> '.png'])
set(gcf,'Color',def_back);
drawnow

 採用された回答

Jan
Jan 2021 年 3 月 24 日
編集済み: Jan 2021 年 3 月 24 日

0 投票

The observation is correct. getframe does not work outside the visible area of the screen. So this is not a problem of imwrite. Try to replace getframe by:
cdata = print(gcf, '-RGBImage')

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeConvert Image Type についてさらに検索

製品

リリース

R2014b

質問済み:

dan
2021 年 3 月 24 日

コメント済み:

dan
2021 年 3 月 25 日

Community Treasure Hunt

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

Start Hunting!

Translated by