[ HDF5 High Level Tutorial Top ] [ Next ] [ Prev ]

H5IM: HDF5 Image
Palettes

A palette is the means by which color is applied to an image and is also referred to as a color lookup table. It is a table in which every row contains the numerical representation of a particular color. In the example of an 8 bit standard RGB color model palette, this numerical representation of a color is presented as a triplet specifying the intensity of red, green, and blue components that make up each color.

Like a HDF5 image, a HDF5 palette is a HDF5 dataset written with standard attributes conforming to the HDF5 Image and Palette Specification. The programming model is similar to the HDF5 image one. To create an HDF5 palette we use the H5IMmake_palette function

H5IMmake_palette( file_id, "Pallete", pal_dims, pal );

This function accepts a parameter file_id, obtained with the basic HDF5 library function H5Fcreate, a palette name, the dimensions of the palette, and the palette data. To associate a palette to any given image we use the function H5IMlink_palette

H5IMlink_palette( file_id, "Image1", "Pallete" );

To read an HDF5 palette we use the H5IMread_image function

H5IMget_palette( file_id, "Image1", pal_number, data );

This function accepts a parameter file_id, obtained with the basic HDF5 library function H5Fopen, a dataset name, a palette index number, and the data.

Deleting images and palettes

Images and palettes are HDF5 datasets, and thus can eliminated from a HDF5 file using the basic HDF5 API functions. Please refer to this API for further information here.


HDF Help Desk
Last modified: November 18, 2002