This function constructs an ENVIRaster from a source raster that has a Linear Percent stretch applied. A linear percent stretch allows you to trim extreme values from both ends of the histogram using a specified percentage.

The result is a virtual raster, which has some additional considerations with regard to methods and properties. See Virtual Rasters for more information, including how they differ from ENVITasks.

The equivalent task is LinearPercentStretchRaster.


; Start the application
e = ENVI()
; Open a file
filename  = FILEPATH('qb_boulder_msi', $
raster = e.openraster(filename)
; Create the stretch raster
stretchRaster = ENVILinearPercentStretchRaster(raster, percent=2.0)
; Display the results
view = e.GetView()
layer = view.CreateLayer(stretchRaster)


Result = ENVILinearPercentStretchRaster(Input_Raster [, Keywords=value])

Return Value

This routine returns an ENVIRaster that has had a Linear Percent stretch applied.



Specify the input ENVIRaster.


This virtual raster inherits methods and properties from ENVIRaster; however the following methods will override the ENVIRaster methods:




BRIGHTNESS (optional)

Set this keyword to an integer value from 0 to 100, indicating the brightness level to display. The default value is 50 if no brightness is specified. You can also set this value to a scalar or an array with the same number of elements as the raster has bands.

ERROR (optional)

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.


Specify a string that identifies the raster.

PERCENT (required)

Set this keyword to a numeric value indicating the percent stretch to be applied.

Version History

ENVI 5.2


ENVI 5.3.1

Documented the dehydrated form of this virtual raster

ENVI 5.4

Added Dehydrate and Hydrate methods; added NAME keyword

API Version


See Also

LinearPercentStretchRaster Task, ENVIEqualizationStretchRaster, ENVIGaussianStretchRaster, ENVILinearRangeStretchRaster, ENVILogStretchRaster, ENVIOptimizedLinearStretchRaster, ENVIRaster, ENVIRootStretchRaster