This method exports all contents of a view to an RGB 24-bit image file. Even if a panchromatic image is displayed in the view, the output will have three bands (red, green, blue). The output image preserves any vector layers, annotation layers, feature counting layers, raster color slices, and image enhancements. It does not preserve any north arrows or cursor probe (crosshairs).

If the view contains a standard base map projection, the output file will be georeferenced to that projection.

On Linux systems, make sure that the view is not obstructed by another dialog or window during the export process.

Note: Color bar, classification legend, and scale bar annotations with the On The Glass property set to True will not be exported.


; Launch the application
e = ENVI()
; Create an ENVIRaster
file = FILEPATH('qb_boulder_msi', ROOT_DIR=e.ROOT_DIR, $
  SUBDIRECTORY = ['data'])
raster = e.OpenRaster(file)
view = e.GetView()
layer = view.CreateLayer(raster)
; open and display the ROIs from qb_boulder_roi
file = Filepath('qb_boulder_roi.xml', ROOT_DIR=e.Root_Dir, $
rois = e.OpenRoi(file)
roiLayers = !NULL
FOREACH roi, rois DO $
  roiLayers = [roiLayers, layer.AddRoi(roi)]
; export the view to a TIFF file
outFile = e.GetTemporaryFilename('tif')
view.Export, outFile, 'TIFF', MAP_SCALE=24000.
; Open the exported file and display it
raster2 = e.OpenRaster(outFile)
layer2 = view.CreateLayer(raster2)


ENVIView.Export, URI, Format [, Keywords=value]



A scalar string denoting the fully qualified file path in which the output image will be saved.


A scalar string denoting the format in which the output image will be saved. The valid string values are as follows:

  • ENVI
  • TIFF



Set this keyword to a named variable that will contain any error message issued during execution of this routine. If no error occurs, the ERROR variable will be set to a null string (''). If an error occurs and the routine is a function, then the function result will be undefined.

When this keyword is not set and an error occurs, ENVI returns to the caller and execution halts. In this case, the error message is contained within !ERROR_STATE and can be caught using IDL's CATCH routine. See IDL Help for more information on !ERROR_STATE and CATCH.

See Manage Errors for more information on error handling in ENVI programming.

EXTENT_FLAG (optional)

By default, ENVIView::Export saves the contents of the current view extent to an output file. Set this keyword to 1 to export the entire dataset extent, not just what is displayed in the view.

MAP_SCALE (optional)

This is one of two keywords that define the pixel resolution of the output image. Enter a denominator value, for example 24000 for a 1:24000 map scale. If you set this keyword, you do not need to set ZOOM_FACTOR. The raster layer must be georeferenced to a standard map projection.

ZOOM_FACTOR (optional)

Enter a double-precision floating point value indicating the zoom factor of the output image. If you set this keyword, you do not need to set MAP_SCALE. This keyword allows for more precision than MAP_SCALE.

Version History

ENVI 5.3.1


API Version


See Also

ENVIView, ENVIView::ChipToFile, ENVIRasterLayer::Export