[Back to Interface] [Prev] [Next]

DFR8getimage/d8gimg

intn DFR8getimage(char *filename, uint8 *image, int32 width, int32 height, uint8 *palette)

filename IN:

Name of the file

image OUT:

Buffer for the returned image

width IN:

Width of the image data buffer

height IN:

Height of the image data buffer

palette OUT:

Palette data

Purpose

To retrieve the image and its palette, if it is present, and store them in the specified arrays.

Return value

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

Description

In C, if palette is NULL, no palette is loaded, even if one is stored with the image. In FORTRAN-77, an array must be allocated to store the palette, even if no palette is expected to be stored. If the image in the file is compressed, DFR8getimage automatically decompresses it. If DFR8getdims has not been called, DFR8getimage finds the next image in the same way that DFR8getdims does.

The width and height parameters specify the number of columns and rows, respectively, in the array which you've allocated in memory to store the image. The image may be smaller than the allocated space.

The order in which you declare dimensions is different between C and FORTRAN-77. Ordering varies because FORTRAN-77 arrays are stored in column-major order, while C arrays are stored in row-major order. (Row-major order implies that the horizontal coordinate varies fastest). When d8gimg reads an image from a file, it assumes row-major order. The FORTRAN-77 declaration that causes an image to be stored in this way must have the width as its first dimension and the height as its second dimension. To take this into account as you read image in your program, the image must be built "on its side".

FORTRAN

integer function d8gimg(filename, image, width, height, palette)

character*(*) filename, image, palette

integer width, height



[Back to Interface] [Prev] [Next]

hdfhelp@ncsa.uiuc.edu
HDF Reference Manual - 07/29/98, NCSA HDF Development Group.