If you want to output a MATLAB® image to use in another application (such as a word-processing program or
graphics editor), use imwrite
to create a file in the appropriate
format. See Write Image Data to File in Graphics Format for
details.
If you want to print an image, use imshow
to display the image in a
MATLAB figure window. If you are using Image Viewer, then you must use the
Print to Figure option on the File menu. When you choose this option, Image Viewer opens a separate
figure window and displays the image in it. You can access the standard MATLAB printing capabilities in this figure window. You can also use the Print to Figure option to print the image displayed in the Overview
tool and the Pixel Region tool.
Once the image is displayed in a figure window, you can use either the MATLAB
print
command or the Print option from the
File menu of the figure window to print the image. When you
print from the figure window, the output includes non-image elements such as labels, titles,
and other annotations.
The output reflects the settings of various properties of graphic objects. In some cases, you might need to change the settings of certain properties to get the results you want. Here are some tips that could be helpful when you print images:
Image colors print as shown on the screen. This means that images are not affected
by the figure object's InvertHardcopy
property.
To ensure that printed images have the proper size and aspect ratio, set the figure
object's PaperPositionMode
property to auto
. When
PaperPositionMode
is set to auto
, the width and
height of the printed figure are determined by the figure's dimensions on the screen. By
default, the value of PaperPositionMode
is manual
.
If you want the default value of PaperPositionMode
to be
auto
, you can add this line to your startup.m
file.
set(0,'DefaultFigurePaperPositionMode','auto')
For detailed information about printing with File/Print
or the print
command, see Print Figure from File Menu. For a complete list of options for the
print
command, enter help print
at the MATLAB command-line prompt or see the print
command reference page.