Save Image Tool
imsave function to create a Save Image tool. The
Save Image tool displays an interactive file chooser dialog box (shown below) in which
you can specify a path and filename. When you click Save, the
Save Image tool writes the target image to a file using the image file format you select
in the Files of Type menu. For more information about using the tool, see Tips.
imsave creates a Save Image tool in a separate figure that is
associated with the image in the current figure, called the target image.
imsave( creates a Save Image tool
associated with the image specified by the handle
Read a grayscale image into the workspace. Display the image.
I = imread('coins.png'); imshow(I)
Process the image. This example creates a binary mask in which the background is black and the coins are white.
bw = imbinarize(I); bw = imfill(bw,'holes'); imshow(bw,)
Save the binary image to file by using the Save Image tool. You can navigate to the desired directory and specify the file name and file format. This example saves the image to the Desktop with the file name myMaskImage in the JPEG file format.
h— Handle to graphics object
Handle to a figure, axes, uipanel, or image graphics object, specified as
a handle. If
h is an axes or figure handle,
imsave uses the first image returned by
filename— Full path to file
Full path to file, returned as a character vector. If you cancel the save
filename is returned as an empty character
user_canceled— User canceled operation
User canceled operation, returned as
true. If you press the Cancel
button or close the save window,
In contrast to the Save as option in the figure File menu, the Save Image tool saves only the image displayed in the figure. The Save as option in the figure window File menu saves the entire figure window, not just the image.
imwrite to save the image,
using default options.
If you specify a filename that already exists,
displays a warning message. Select Yes to use the filename
or No to return to the dialog to select another filename.
If you select Yes, the Save Image tool attempts to
overwrite the target file.
The Save Image tool is modal; it blocks the MATLAB® command line until you respond.