Zooming image with no border

1 view (last 30 days)
Callum Clarke
Callum Clarke on 1 Jun 2016
Answered: Walter Roberson on 1 Jun 2016
I have a window that shows an image that I need to zoom in and out on, but I would like to get rid of the grey border that frames the image when zooming in. Examples below.
I'm guessing I need to somehow change the 'inner frame' dimensions to fill the window instead of it having the aspect ratio of the full image. I have tried the Border property but it only affects it in relation to the full image aspect ratio.
Full image:
Zoomed image:

Answers (1)

Walter Roberson
Walter Roberson on 1 Jun 2016
Consider that if you had only zoomed by a small fraction then you would not expect the image to suddenly jump to fill the entire vertical space: you would probably expect instead that as you zoomed it would take up more and more of the vertical space until it reached the edge.
What you will probably want to do is give an ActionPostCallback on the zoom, that figures out the best InnerPosition to use taking into account the xlim and ylim and the image size and the available area. See http://blogs.mathworks.com/community/2007/12/10/focused-on-zooming/

Categories

Find more on Data Exploration 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!