Introduction to HDF5 
HDF5 Reference Manual 
Other HDF5 documents and links 
And in this document, the HDF5 User's Guide:    
Files   Datasets   Data Types   Dataspaces   Groups  
References   Attributes   Property Lists   Error Handling  
Filters   Palettes   Caching   Chunking   Mounting Files  
Debugging   Environment   DDL   Ragged Arrays  

HDF5 Palette Specification

This section is a work in progress page. Please send comments to davet@ncsa.uiuc.edu. Anything and everything on this page may be changed.

Questions regarding this specification:


Changes made since last revision


HDF 5.0 Palette Overview:

HDF 5.0 adds the following new features to what existed in earlier HDF versions:


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.

In this example, the color component numeric type is an 8-bit unsigned integer. While this is most common and recommended for general use, other component color numeric data types, such as a 16-bit unsigned integer , may be used. This type is specified as the type attribute of the palette dataset. (see H5Tget_type(), H5Tset_type())

The minimum and maximum values of the component color numeric are specified as attribute of the palette dataset. See below (attributes PAL_MINNUMERIC, PAL_MAXNUMERIC). If these attributes do not exist, it is assumed that the range of values will fill the space of the color numeric type. i.e. with an 8-bit unsigned integer, the valid range would be 0 to 255 for each color component.

The HDF 5.0 palette specification additionally allows for color models beyond RGB. YUV, HSV, CMY, CMYK, YCbCr color models are supported, and may be specified as a color model attribute of the palette dataset. (see "Palette Attributes" for details).

In HDF 4 and earlier, palettes were limited to 256 colors. The HDF 5.0 palette specification allows for palettes of varying length. The length is specified as the number of rows of the palette dataset.

In a standard palette, the color entries are indexed directly. HDF 5.0 supports the notion of a range index table. Such a table defines an ascending ordered of ranges that map dataset values to the palette. If a range index table exists for the palette, the PAL_TYPE attribute will be set to "RANGEINDEX", and the PAL_RANGEINDEX attribute will contain an object reference to a range index table array. If not, the PAL_TYPE attribute either does not exist, or will be set to "STANDARD".

The range index table array consists of a one dimensional array with the same length as the palette dataset - 1. Ideally, the range index would be of the same type as the dataset it refers to, however this is not a requirement.

Example 2: A range index array of type floating point

The range index array attribute defines the "to" of the range. Notice that the range index array attribute is one less entry in size than the palette. The first entry of 0.1259, specifies that all values below and up to 0.1259 inclusive, will map to the first palette entry. The second entry signifies that all values greater than 0.1259 up to 0.3278 inclusive, will map to the second palette entry, etc. All value greater than the last range index array attribute (100000) map to the last entry in the palette.


Palette Attributes

A palette exists in an HDF file as an independent data set with accompanying attributes.

These attributes are defined as follows:

Attribute name="CLASS"
This attribute is of type H5T_STR_NULLTERM.
For all palettes, the value of this attribute is "PALETTE". This attribute identifies this palette data set as a palette that conforms to the specifications on this page.

Attribute name="PAL_COLORMODEL"
This attribute is of type H5T_STR_NULLTERM.
Possible values for this are "RGB", "YUV", "CMY", "HSV".
This defines the color model that the entries in the palette data set represent.
"RGB"
Each color index contains a triplet where the the first value defines the red component, second defines the green component, and the third the blue component.

"CMY"
Each color index contains a triplet where the the first value defines the cyan component, second defines the magenta component, and the third the yellow component.

"CMYK"
Each color index contains a quadruplet where the the first value defines the cyan component, second defines the magenta component, the third the yellow component, and the forth the black component.

"YCbCr"
Class Y encoding model. Each color index contains a triplet where the the first value defines the luminance, second defines the Cb Chromonance, and the third the Cr Chromonance.

"YUV"
Composite encoding color model. Each color index contains a triplet where the the first value defines the luminance component, second defines the chromonance component, and the third the value component.

"HSV"
Each color index contains a triplet where the the first value defines the hue component, second defines the saturation component, and the third the value component. The hue component defines the hue spectrum with a low value representing magenta/red progressing to a high value which would represent blue/magenta, passing through yellow, green, cyan. A low value for the saturation component means less color saturation than a high value. A low value for value will be darker than a high value.

Attribute name="PAL_TYPE"
This attribute is of type H5T_STR_NULLTERM
The current supported values for this attribute are : "STANDARD8" or "RANGEINDEX"

A PAL_TYPE of "STANDARD8" defines a palette dataset such that the first entry defines index 0, the second entry defines index 1, etc. up until the length of the palette - 1. This assumes an image dataset with direct indexes into the palette.

If the PAL_TYPE is set to "RANGEINDEX", there will be an additional attribute with a name of "PAL_RANGEINDEX", The PAL_RANGEINDEX attribute contains an HDF object reference pointer which specifies a range index array in the file to be used for color lookups for the palette. (See example 2 for more details)

Attribute name="PAL_MINNUMERIC"
Attribute name="PAL_MAXNUMERIC"
These two attributes are of the same type as the palette elements or color numerics.
They specify the minimum and maximum values of the color numeric components. For example, if the palette was an RGB of type Float, the color numeric range for Red, Green, and Blue could be set to be between 0.0 and 1.0. The intensity of the color guns would then be scaled accordingly to be between this minimum and maximum attribute.



Specifying a Palette for a Dataset

A dataset within an HDF5 file may specify an array of palettes to be viewed with. The dataset will have an attribute field called "PALETTE" which contains an array of object reference pointers which refer to palettes in the file. The first palette in this array will be the default palette that the data may be viewed with.
Introduction to HDF5 
HDF5 Reference Manual 
Other HDF5 documents and links 
And in this document, the HDF5 User's Guide:    
Files   Datasets   Data Types   Dataspaces   Groups  
References   Attributes   Property Lists   Error Handling  
Filters   Palettes   Caching   Chunking   Mounting Files  
Debugging   Environment   DDL   Ragged Arrays  

HDF Help Desk
Last modified: 23 July 1999