Images that are less than 8 bits per pixel
require a palette, which is an array of color values. The
value of each pixel in one of these images is an index into
the palette. (Images that are 16 bits per pixel or higher
store the color values directly in the image, as pixel values.)
The number of colors in a palette
is limited to the highest possible index value. For example,
if an image is 8 bits per pixel, it can have a palette of
256 colors, which is the number of different colors that
can be referenced by using the pixel values as 8-bit indexes.
If an image file is less than
16 bits per pixel, the file contains a palette, and when
you load the image into a bitmap, the palette is also loaded
into the LEAD bitmap handle structure.
Fixed
Palettes and Optimized Palettes
A Fixed Palette is a
single standard palette that contains colors uniformly covering
the entire range of possible colors. This is useful if you
must convert an arbitrary set of images to use the same
palette, particularly if you don't know in advance all of
the images which will share the palette, or if you must
display multiple images simultaneously on a display device
with a bit-depth of 8-bits (256 colors) or less (see Palette
Shifts below).
LEADTOOLS gives you
the option to convert an image using a Fixed Palette
(actually changing the image and image's palette),
or to display an image using a fixed palette to
paint to the device (without changing the original
image). LEADTOOLS supports the LEAD fixed palette
and the Netscape fixed palette, which are shown
below:

LEADTOOLS also gives you the
option of creating a an Optimized
Palette , or a palette with the best possible
colors for a particular image or set of images.
Shown at right is a True Color image which has been
converted to 8-bits/pixel (256 color) using both
an optimized palette (automatically generated from
the original image data) and a fixed palette (for
comparison). |
|
Palette
Shifts
So why would you use a fixed
palette if optimized palette is going to give you closer
color matching? Fixed palettes come in very handy when
you have to display several images simultaneously on a
device that can only display 256 colors or less.
Shown
at right is a capture of two images displayed while
Windows is in 256 color display mode, both with
and without using fixed palettes.
When fixed palettes are not used,
whichever image is last painted controls what palette
the entire display uses. When fixed palettes are used,
both images display properly regardless of which image
was last painted. |
 |