The HDF5 Image API defines a standard storage for HDF5 datasets that are intended to be interpreted as images. This version of the API is primarily concerned with two dimensional raster data, which are indexed 8 bit images (an image in which each pixel stored is an index into a table palette), and 24 bit true color images (an image where the pixel storage contains 3 color planes, red , green , blue, in this case)
Writing Indexed Images and Palettes
H5IMmake_image_8bitfunction is used:
This function accepts a parameter
file_id, obtained from the basic HDF5 library function
H5Fcreate, a dataset name, the width and height of the dataset, and the data. This function is most useful when associated with a palette.
The following table represents a palette with 9 entries:
The following example demonstrates how to create an indexed HDF5 image with an associated palette.
Writing True Color Images and Reading Images
H5IMmake_image_24bitfunction is used:
The images obtained are:
Processing all the data.
Processing the land data.
Processing the sea data.
Like an HDF5 image, an HDF5 palette is an HDF5 dataset written with standard attributes conforming to the HDF5 Image and Palette Specification. The programming model is similar to the HDF5 image model. To create an HDF5 palette the
H5IMmake_palette function is used: