getframe pixel dimensions do not match figure position

1 回表示 (過去 30 日間)
Doug
Doug 2022 年 1 月 29 日
When I use getframe.m, I expect it to produce an image that exactly matches what I see on screen. But getframe produces an image whose pixel dimensions do not match the size of the figure -- if the figure is on the built-in display of my laptop. If I move the figure to the external display (connected to my laptop), getframe produces an imge whose pixel dimensions do match the size of the figure. I'm running Matlab R2020b on MacOS 11.6.
How can I make getframe work as expected on my built-in display?
Example code:
>> figure; image
>> get(gcf,'position') % on built-in display
ans =
677 160 560 420
>> snap = getframe(gcf); size(snap.cdata) % does not match!
ans =
840 1120 3
>> get(gcf,'position') % on external display
ans =
789 1074 560 420
>> snap = getframe(gcf); size(snap.cdata) % does match
ans =
420 560 3

回答 (0 件)

カテゴリ

Help Center および File ExchangeEnvironment and Settings についてさらに検索

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by