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.
Syntax
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] )
Return Value
This routine returns 1 if the “Save” button was clicked, and 0 if the “Cancel” button was clicked.
Arguments
Image
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.
Keywords
DIALOG_PARENT
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.
FILENAME
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.
FIX_TYPE
When this keyword is set, only files that satisfy the type can be selected. The user has no ability to modify the type.
NOWRITE
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.
OPTIONS
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.
PATH
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.
TITLE
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.
TYPE
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).
WARN_EXIST
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.
Examples
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.
Field |
Description |
Drive
|
Select the directory in which to save the image file
|
File name |
Enter the file name
|
Save as
|
Select the image file format
|
Save |
Save the image file
|
Cancel
|
Cancels the save function
|
Options |
Brings up a dialog box of image format save options, which varies depending on image format
|
Version History
See Also
DIALOG_READ_IMAGE