HDFPUTR8 Function

Writes an 8 bit image to an HDF file.

Restriction: See "Supported Platforms Guide" on the PV-WAVE Documentation website to check if this function is available on your operating system.

Usage

    status = HDFPUTR8 (filename, image)

Input Parameters

filename—A string containing the name of the HDF file.

image—A byte array containing the 8 bit image to write to the file.

Return Value

status—The status of the function call, where:

  • SUCCEED (0)—Indicates success.

  • FAIL (–1)—Indicates failure.

Keywords

Append—If present and nonzero, append the image to the end of the HDF file. By default, the image is not appended and the contents of the file are overwritten.

Compression—Defines the compression scheme to use when writing the image. Possible values are:

  • 0—No compression

  • DFTAG_RLE—Run length encoding (RLE)

  • DFTAG_IMCOMP—IMCOMP compression

The default value is 0 (no compression is used).

Help—If present and nonzero, lists the usage for this routine.

Palette—A byte array containing an HDF palette to write with the image. This palette is pixel interlaced (r, g, b, r, g, b, ...) and cannot be a standard PV‑WAVE color table.

Usage—If present and nonzero, lists the usage for this routine. (Same as the Help keyword.)

Discussion

HDFPUTR8 writes an 8 bit image and associated palette to an HDF file. The Append keyword lets you write additional 8 bit images to the same file.

Example

hdf_init
@hdf_common

; Read in the base image data
rawimagefile = !Data_dir + 'mandril.img'
image_0 = BYTARR (512, 512)
OPENR, unit, rawimagefile, /Get_lun
READU, unit, image_0
FREE_LUN, unit

; Generate the small image
image_1 = REBIN (image_0, 64, 64)

; Write the HDF file
testfile = 'hdfputr8_ex1_output.hdf'
status = HDFPUTR8(testfile, image_0)
IF (status EQ FAIL) THEN MESSAGE, 'HDFPUTR8 failed.'
status = HDFPUTR8(testfile, image_1, /Append)
If (status EQ FAIL) THEN $
   MESSAGE, 'HDFPUTR8 failed with Append.'

See Also

HDFGETR8, HDFPUT24, HDFPUTSDS

Also refer to the following routines in the HDF Reference Manual:

DFR8ADDIMAGE, DFR8PUTIMAGE, DFR8SETPALETTE

For more information on using the HDF interface and the calling sequence for the entire suite of HDF base functions, refer to PV-WAVE HDF Interface.

For a complete list of the HDF convenience routines, refer to Functional Summary of Routines.