Print Images

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 Writing Image Data to Files for details.

If you want to print an image, use imshow to display the image in a MATLAB figure window. If you are using the Image Viewer, you must use the Print to Figure option on the File menu. When you choose this option, the 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 nonimage elements such as labels, titles, and other annotations.

Handle Graphics Properties That Impact Printing

The output reflects the settings of various properties of Handle 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 (and for information about Handle Graphics), see Overview of Printing and Exporting in the MATLAB Graphics documentation. 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 in the MATLAB documentation.

Was this topic helpful?