getframe pixel dimensions do not match figure position
5 views (last 30 days)
Show older comments
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 Comments
Answers (0)
See Also
Categories
Find more on Printing and Saving in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!