Routines (alphabetical) > Routines: H > HDF Routines > HDF_GR_WRITEIMAGE

# HDF_GR_WRITEIMAGE

This function writes the subsample of the raster image data stored in the variable data to the specified raster image. The subsample is defined by the values of the parameters start, stride and edge. The array start specifies the starting location of the subsample to be written. Valid values of each element in the array start are 0 to the size of the corresponding raster image dimension - 1.

Note: The correspondence between elements in the array start and the raster image dimensions in the HDF GR interface is different from that in the HDF SD interface. The array stride specifies the writing pattern along each dimension. For example, if one of the elements of the array stride is 1, then every element along the corresponding dimension of the array data will be written. If one of the elements of the stride array is 2, then every other element along the corresponding dimension of the array data will be written, and so on. The correspondence between elements of the array stride and the dimensions of the array data is the same as described above for the array start. Each element of the array edges specifies the number of data elements to be written along the corresponding dimension. The correspondence between the elements of the array edges and the dimensions of the array data is the same as described above for the array start.

## Syntax

Result = HDF_GR_WRITEIMAGE( ri_id, data [, EDGE=array] [, INTERLACE={0 | 1 | 2}] [, START=array] [, STRIDE=array] )

## Return Value

Returns SUCCEED (0) if successful or FAIL (-1) otherwise.

## Arguments

### ri_id

Raster image identifier returned by HDF_GR_CREATE or HDF_GR_SELECT.

### data

The image data to be written.

## Keywords

### EDGE

Array containing the number of data elements that will be written along each dimension. If not specified, all data will be written.

### INTERLACE

Set this keyword to a scalar value to select the interlace mode of the input data. Valid values are:

- 0 = Pixel interlace
- 1 = Line interlace
- 2 = Component interlace

HDF_GR_WRITEIMAGE will write the data in the correct interlace mode the raster image is in.

### START

Array containing the two-dimensional coordinate of the initial location for the write. If not specified, the write starts at the first pixel in each dimension (start=[0,0]).

### STRIDE

Array containing the number of data locations the current location is to be moved forward before each write. If not specified, data is written contiguously (stride = [1,1]).

Note: See HDF_GR_READIMAGE for further description of the EDGE, START, and STRIDE keywords.

## Version History

5.2 | Introduced