How to get image of figure with exact same size after saving on computer

30 views (last 30 days)
Rafi Ahmed on 22 Sep 2019
Edited: Rafi Ahmed on 25 Sep 2019
I would like to save image from a figure with exact same size. I have used export setup for specific size (e.g. points) of image. However, it becomes a different dimension after saving on computer memory. Is there any way to get the image of that figure with exact same size after saving it.

Image Analyst on 22 Sep 2019
Using saveas() or export_fig() will give you an image the same size in pixels as the displayed figure.
If you have an axes on that figure and want just the stuff in the axes, you can use getimage() or getframe() to get an image.
If you have an image, you can use imwrite() and that will save it with the same size.

Rafi Ahmed on 25 Sep 2019
Sir,
Thanks for your comment. I could not understand the procedure. Would you please explain the process of linearizing the values?
Walter Roberson on 25 Sep 2019
You have
[Az Doppler] = meshgrid(sin(phi*pi/180),fdop);
so Az will be "sin spaced" apart -- closer together near -180, 0, and +180 than near +-90 degrees. When you then use Az as the x coordinate for pcolor, it has to put the elements closer together or further apart because of that.The distance between adjacent values is not constant with what you are doing now. But when you create an image, the distance between adjacent values (pixels) is constant. So you have to substitute in original non-linearly spaced phi coordinates such that sin() of them translates after the sin() to be linearly spaced.
However, I just realized that you have a problem: for each x value in the range (-1,1) exclusive, there are two phi values that map to that same x value. Your surface folds back on itself, and you need to decide which of the folds is the one that you want to appear in the output.
Rafi Ahmed on 25 Sep 2019
Sir,
Yes you are right. The values fold back and I need all of them in one image. I guess, there is no option but to use pcolor for that. But I could not understand that if I have the figure, why couldn't I save the figure with the size of 360x360 dimension? It is always converted into another dimension (e.g. 525x700) when saving on computer memory. When I resize it to 360x360, it has some loss probably. Do you think that, resizing image has better solution?