How to resize and display an image......

Hi All,
So when i do imagesc(img); it shows an image as follows:
However i want it to be displayed like this :
[EDITED, Jan, above picture is too wide to be embedded]
The difference is that the latter has been resized using the image resizing handles (from the corners of the image). Just to emphasise, i mean these handles :
^^but when applied to a figure in MATLAB.
I know i can do this manually but i want to incorporate this in my .m file and hence want to keep it automated.
Many thanks!!

 Accepted Answer

Image Analyst
Image Analyst on 20 Jun 2012
Define manual and automated. If you have handles for the user to manually drag, then that does not seem automated to me.

9 Comments

Manual is when i manually resize the image from the first image to the second (as shown in the two images above).
Automatically is when MATLAB does it for me automatically. Thanks!
If you know the desired output size in advance, then you can use imresize(). I guess that's automatic, though you do have to "manually" determine what the target size is.
I see. Could you kindly point me in the right direction to find out how to determine what the right target size is please?
How could I possibly know what size you want your image to be? Why don't you tell me why you want to resize it in the first place?
Because the plot that iam displaying is basically too stretched when i type in plot(x,y); For me to interpret the graph correctly, i have to resize it so the points look more or less like what i want. Thanks.
Only you will know what is "too stretched" and "looks like what you want". Keep in mind that there may be a difference between how it appears on different video monitors.
Have you tried
axis equal
?
@ IM, fair enough.
@Walter Roberson, i dont want to change the axis, resize the graph rather.
axis equal will resize the graph so that it does not looked stretched.
Anyhow, consider set()'ing the axes Position property, perhaps using 'Units', 'normalized'

Sign in to comment.

More Answers (1)

Community Treasure Hunt

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

Start Hunting!