ras_palette - Man Page

Name

ras_palette - format descriptions for palette files for NCAR View

Synopsis

palette_file.pal
palette_file.txt

Description

NCAR View supports a binary as well as a textual format for color palettes.

The binary format is compatible with NCSA HDF and must have a file extension of ".pal". The palette has a red, a green, and a blue table, each with 256 single unsigned byte entries. A 0 represents no intensity for a given color, and a 255 full intensity. In the file, the palette is stored as:

R0 R1 ... R255 G0 G1 ... G255 B0 B1 ... B255

for a total of 768 bytes.

The textual format can be created by a program or manually with a text editor. It provides for 256 RGB entries but also allows for a sparse color table. In the latter case, missing values are calculated from those provided using linear interpolation. If unspecified, the 0 entry defaults to black and the 255 entry to white.  Each color palette entry has the following format:

index_number red green blue

where index_number, red, green, and blue are all integers in the range 0 to 255.

Examples

All of the examples below deal with textual color palettes.

Setting Entries

Set color index 0 to black.

0 0 0 0

Set color index 255 to white

255 255 255 255
Grayscale Ramp

Let's suppose you have a file named "my.txt" and it has just two lines in it: the black entry and the white entry from above. This will produce a grayscale color palette, where the table starts at black and ramps up to white; since only entries 0 and 255 are specified, the remaining indicies are interpolated.

0 0 0 0
255 255 255 255

(Note: An empty palette file (e.g. "empty.txt") is legal and, since the 0 index defaults to black and the 255 index to white, produces a grayscale ramp just as in the above example.)

Temperature Color Scale

Let's suppose you want entry 0 to be black, and the remaining indices to start at 1 with a fully-saturated blue and shift linearly to 255 with a fully-saturated red. Only three entries are required in your file, "temp.txt".

0 0 0 0
1 0 0 255
255 255 0 0

See Also

rasview(1NCARG),rascat(1NCARG),rasgetpal(1NCARG), rassplit(1NCARG),rasls(1NCARG),ras_formats(5NCARG)

Bugs/Caveats

Color palettes are only useful with indexed-color imagery.

Info

January 1993 NCARG NCAR GRAPHICS