This function creates an HDF GR raster image. Once a raster image has been created, it is not possible to change its name, data type, dimension sizes or number of pixel components. However, it is possible to create a raster image and close the file before writing any data values to it. Later, the values can be added to or modified in the raster image, which then can be obtained using HDF_GR_SELECT.

Note: On creation, any interlace mode may be set. This mode will be used until the file is closed. If the resulting file is reopened, the interlace mode will revert to pixel-interlace (0). Data can still be read in any interlace mode using the INTERLACE keyword to HDF_GR_READIMAGE. This is a limitation of the current HDF library.


Result = HDF_GR_CREATE(gr_id, name, ncomp, data_type, interlace_mode, dim_sizes)

Return Value

Returns a raster image identifier if successful or FAIL (-1) otherwise.



GR interface identifier returned by HDF_GR_START.


Name of the raster image. The length of the name should not be longer than 256 characters.


Number of pixel components in the image. This parameter must have a value of at least 1.


Type of the image data. This parameter can be any of the data types supported by the HDF library.


Interlace mode of the image data. Valid values are:

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


Array of sizes for each dimension of the image. The dimensions must be specified and their values must be greater than 0.



Version History