The Export method saves a raster layer to a TIFF format. It saves the full raster layer extent, with image enhancements, at full resolution.


; Launch the application
e = ENVI()
; Create an ENVIRaster
file = FILEPATH('qb_boulder_msi', ROOT_DIR=e.ROOT_DIR, $
  SUBDIRECTORY = ['data'])
raster = e.OpenRaster(file)
; Stretch the raster
stretchRaster = ENVIEqualizationStretchRaster(raster, $
MIN=[138,154,92,52], MAX=[1492,2047,1785,1807])
; Create a new layer containing the stretched raster
view = e.GetView()
rasterLayer = view.createLayer(stretchRaster)
; Create a temporary output file
newFile = e.GetTemporaryFilename('tif')
; Export the raster layer's data as a TIFF.
; If the exported data contains information,
; a geoTIFF structure will be written to the file.
rasterLayer.Export, newFile, 'TIFF'
; Open the resulting TIFF/geoTIFF file
; and display it in a new ENVI layer
raster2 = e.OpenRaster(newFile)
layer = view.CreateLayer(raster2)


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



A scalar string denoting the fully qualified file path in which the raster layer's data will be saved.


A scalar string denoting the format in which the raster layer's data will be saved. The valid string values are as follows:

  • 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.

Version History

ENVI 5.3.1


API Version


See Also

ENVIRasterLayer, ENVIView::Export, ENVIView::ChipToFile