keeping original size of image when using imagesc

조회 수: 28 (최근 30일)
Mara Fries
Mara Fries 2020년 11월 28일
댓글: Mara Fries 2020년 11월 29일
I'm programming a GUI and trying to show an image using imagesc. The GUI should be able to show images of different sizes. I put axes with a specific size in there but it's more of a placeholder - I'd like to change its size depending on the size of the image being displayed.
So for example I'm having the figure window with a rectangular shape but want to show a squared image without it being streched to fit the window, I hope I got my problem across. It does work when im using imshow, then the image keeps its original size automatically, but it doesn't when I'm using imagesc to display the image.

채택된 답변

M.Many
M.Many 2020년 11월 28일
Hi, you can use
image(imageToDisplay)
axis image
to keep the ratio 1 to 1
I hope this helps
  댓글 수: 1
Mara Fries
Mara Fries 2020년 11월 29일
Yes, that works, thank you so much for the quick help!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Images에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by