Image Processing Toolbox User's Guide Previous page   Next Page

Specifying the Initial Image Magnification

By default, imshow attempts to display an image in its entirety at 100% magnification (one screen pixel for each image pixel). However, if an image is too large to fit in a figure window on the screen at 100% magnification, imshow scales the image to fit onto the screen and issues a warning message.

To override the default initial magnification behavior for a particular call to imshow, specify the InitialMagnification parameter. For example, to view an image at 150% magnification, use this code.

imshow attempts to honor the magnification you specify. However, if the image does not fit on the screen at the specified magnification, imshow scales the image to fit and issues a warning message. You can also specify the text string 'fit' as the initial magnification value. In this case, imshow scales the image to fit the current size of the figure window.

You can also change the default initial magnification behavior of imshow by setting the ImshowInitialMagnification toolbox preference. To make this preference persist between sessions, include the command to set the preference in your startup.m file. To learn more about toolbox preferences, see Setting the Values of Toolbox Preferences.

When imshow scales an image, it uses interpolation to determine the values for screen pixels that do not directly correspond to elements in the image matrix. For more information, see Interpolation.


Previous page  Using imshow to Display Images Controlling the Appearance of the Figure Next page

© 1994-2005 The MathWorks, Inc.