The DIALOG_WRITE_IMAGE function is a graphical user interface allowing you to save an IDL array variable as an image file, selecting a location and image file type. The interface is created as a modal dialog with an optional parent widget.
Result =DIALOG_WRITE_IMAGE ( Image [, R, G, B] [, DIALOG_PARENT=widget_id] [, FILENAME=string] [, /FIX_TYPE] [, /NOWRITE] [, OPTIONS=variable] [, PATH=string] [ ,TITLE=string] [, TYPE=variable] [, /WARN_EXIST] )
This routine returns 1 if the “Save” button was clicked, and 0 if the “Cancel” button was clicked.
The array to be written to the image file.
R, G, B
These are optional arguments defining the Red, Green, and Blue color tables to be associated with the image array.
The widget ID of a widget that calls DIALOG_WRITE_IMAGE. When this ID is specified, a death of the caller results in the death of the DIALOG_WRITE_IMAGE dialog. If DIALOG_PARENT is not specified, then the interface is created as a modal, top-level widget.
Set this keyword to a scalar string that contains the name of the initial file selection. This keyword is useful for specifying a default filename.
When this keyword is set, only files that satisfy the type can be selected. The user has no ability to modify the type.
Set this keyword to prevent the dialog from writing the file when “Save” is clicked. No data conversions will take place when the save type is chosen.
Set this keyword to a named variable to contain a structure of the chosen options by the user, including the filename and image type chosen.
Set this keyword to a string that contains the initial path from which to select files. If this keyword is not set, the current working directory is used.
Set this keyword to a scalar string to be used for the dialog title. If it is not specified, the default title is “Save Image File”.
Note: You can use language catalogs to internationalize this value with strings in particular languages.
Set this keyword to a scalar string containing the format type the “Save as type” field should begin with. The default is “TIFF”. The user can modify the type unless the FIX_TYPE keyword is set. Valid values are obtained from the list of supported image types returned from QUERY_IMAGE. The “Save as type” field will reflect the type of the selected file (if one is selected).
Set this keyword to produce a question dialog if the user selects a file that already exists. The default is to quietly overwrite the file.
The following statements create and write a simple image to a .tif file name myimage.tif:
myimage = DIST(100)
result = DIALOG_WRITE_IMAGE(myimage, FILENAME='myimage.tif')
Using the Save Image File Dialog
When you issue the previous statements, the Save Image File dialog opens.
Use the following fields to configure how the image is saved.
Select the directory in which to save the image file
Enter the file name
Select the image file format
Save the image file
Cancels the save function
Brings up a dialog box of image format save options, which varies depending on image format