The ChipToFile method chips the contents of a view directly to a file.

Example


; Launch the application
e = ENVI()
 
; Create an ENVIRaster
file = FILEPATH('qb_boulder_pan', ROOT_DIR=e.ROOT_DIR, $
  SUBDIRECTORY = ['data'])
raster = e.OpenRaster(file)
 
; Display the raster
view = e.GetView()
layer = view.CreateLayer(raster)
 
; Create a temporary output file
newFile = e.GetTemporaryFilename('tif')
 
; Chip the view to a TIFF file
view.ChipToFile, newFile, 'TIFF'
 
; Open the TIFF file
raster2 = e.OpenRaster(newFile)
 
; Display the chip in a new view
view2 = e.CreateView()
layer2 = view2.CreateLayer(raster2)

Syntax


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

Arguments


URI

A scalar string denoting the fully qualified file path for the saved chip.

Format

A scalar string denoting the file format for the saved chip. An error is thrown if the format is unrecognized or unsupported by the raster. The valid string values are:

Format Strings

Description

envi (default)

The ENVI image format. When you select this option, ENVI creates and saves an associated header file (.hdr) to disk.

kml

KML is a file format used to display geographic data in a mapping service such as Google Earth, Google Maps, and Google Maps for mobile.

jpeg2000

 

nitf

Specifies NITF 2.0 and 2.1 or NSIF 1.0. If you select this option, you must also set the NITF_COMPRESSION keyword.

You will lose all NITF metadata, and default metadata values will be used based on NITF preferences.

pdf

Adobe PDF document

ppt

PowerPoint presentation file. This option is only available on Windows systems, and it requires the system to have Microsoft PowerPoint presentation software installed and licensed.

tiff

TIFF and GeoTIFF

Keywords


Note: Keywords not associated with the given format are quietly ignored.

AUTHOR

If you specified pdf as the Format value, set this keyword to a string denoting the author of the document. This information will be part of the PDF document properties.

DESCRIPTION

If you specified kml as the Format value, set this keyword to a string or array of strings denoting the description of the document. This information will be part of the document metadata.

If you specified ppt as the Format value, set this keyword to a string or array of strings denoting the description of the document. This information will be part of the Notes section of the slide. If the center of the chip has known coordinates, these will also be added to the notes of the slide.

ERROR

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.

KEYWORDS

If you specified pdf as the Format value, set this keyword to a comma-separated string denoting the keywords associated with the document. This information will be part of the PDF document properties.

NITF_COMPRESSION

If you used 'nitf' as the Format value, set this keyword to a string denoting the NITF compression type. The valid string values are as follows:

  • epje num lossless
  • epje vis lossless
  • jpeg dct (high)
  • jpeg dct (low)
  • jpeg dct (medium)
  • no compression (default)
  • npje num lossless
  • npje vis lossless
  • transcode epje to npje
  • transcode npje to epje

See Compression Options for more details on these settings.

SUBJECT

If you specified pdf as the Format value, set this keyword to a string denoting the subject of the document. This information will be part of the PDF document properties.

TITLE

If you specified pdf as the Format value, set this keyword to a string denoting the title of the document. This information will be part of the PDF document properties.

If you used kml as the Format value, set this keyword to a string denoting the title of the document. This information will be displayed as the layer name.

Version History


ENVI 5.3

Introduced

API Version


4.3s

See Also


ENVIView, ENVIView::Chip, ENVIView::Export, ENVIRasterLayer::Export