Main Content

Manage Display Settings

You can control how Image Processing Toolbox™ displays images either by using settings or by using function name-value arguments. Settings control the default display of all images for imshow and the Image Tool (imtool). You can also use name-value arguments, in functions such as imshow, to override default settings for individual images.

This page shows you how to use settings and name-value arguments to control how images display.

Retrieve Toolbox Settings

Retrieve the current setting values using one of these options:

  • Interactively — Use the Settings window. To access the window, on the Home tab, in the Environment section, click Settings button Settings. You can also open the Settings window from the Image Tool (imtool), under File > Preferences. Access settings for the Image Tool and hardware optimizations in the Image Processing Toolbox page of the Settings window. Access imshow settings under MATLAB > Image Display.

  • Programmatically — Use the iptgetpref function. For example, this code retrieves the value of the ImtoolInitialMagnification setting.

iptgetpref("ImtoolInitialMagnification")

Set Toolbox Settings

Set Image Processing Toolbox settings using one of these options:

  • Interactively — Use the Settings window. To access the window, on the Home tab, in the Environment section, click Settings button Settings. You can also open the Settings window from the Image Tool (imtool), under File > Preferences. Access settings for the Image Tool and hardware optimizations in the Image Processing Toolbox page of the Settings window. Access imshow settings under MATLAB > Image Display.

  • Programmatically — Use the iptsetpref function. For example, this code specifies that, by default, imshow resize the figure window tightly around displayed images.

iptsetpref("ImshowBorder","tight");

For a complete list of toolbox settings, see the iptsetpref reference page.

Control Image Display Using Settings and Name-Value Arguments

This example shows how to control image magnification in the Image Tool using settings versus name-value arguments. Image Processing Toolbox settings control the default display behavior for a function. You can use name-value arguments to override the default settings for individual images.

Display Image Using Factory Default

The imtool function opens images in the Image Tool. By default, the tool displays images at the magnification specified by the ImtoolInitialMagnification setting. The original default value is "adaptive", meaning the app loads images at the largest magnification that fits in the figure.

imtool("peppers.png")

Peppers image displayed using the Image Tool with the defaul initial magnification setting.

Update Default Using Settings

To display images at 80% magnification by default, update the ImtoolInitialMagnification value by using the Settings window or the iptsetpref function. Note that the Image Tool now displays images at 80% magnification by default.

iptsetpref("ImtoolInitialMagnification",80);
imtool("peppers.png")

Peppers image displayed at 80% magnification

Override Setting Using Name-Value Argument

To display a single image at 50% magnification, without changing the default value, include the InitialMagnification name-value argument when you call imtool. You do not need to update the ImtoolInitialMagnification setting.

imtool("peppers.png",InitialMagnification=50)

Peppers image displayed at 50% magnification

See Also

| |