ZOOM Image Zoom Function

Section: Handle-Based Graphics

Usage

This function changes the zoom factor associated with the currently active image. It is a legacy support function only, and thus is not quite equivalent to the zoom function from previous versions of FreeMat. However, it should achieve roughly the same effect. The generic syntax for its use is
  zoom(x)

where x is the zoom factor to be used. The exact behavior of the zoom factor is as follows:

Example

To demonstrate the use of the zoom function, we create a rectangular image of a Gaussian pulse. We start with a display of the image using the image command, and a zoom of 1.
--> x = linspace(-1,1,300)'*ones(1,600);
--> y = ones(300,1)*linspace(-1,1,600);
--> Z = exp(-(x.^2+y.^2)/0.3);
--> image(Z);
--> zoom(1.0);

At this point, resizing the window accomplishes nothing, as with a zoom factor greater than zero, the size of the image is fixed. If we change the zoom to another factor larger than 1, we enlarge the image by the specified factor (or shrink it, for zoom factors 0 < x < 1. Here is the same image zoomed out to 60%

--> image(Z);
--> zoom(0.6);

Similarly, we can enlarge it to 130%

--> image(Z)
--> zoom(1.3);

The ``free'' zoom of x = 0 results in the image being zoomed to fit the window without changing the aspect ratio. The image is zoomed as much as possible in one direction.

--> image(Z);
--> zoom(0);
--> sizefig(200,400);

The case of a negative zoom x < 0 results in the image being scaled arbitrarily. This allows the image aspect ratio to be changed, as in the following example.

--> image(Z);
--> zoom(-1);
--> sizefig(200,400);