Indexed Color - Palette Size

Palette Size

The palette itself stores a limited number of distinct colors; 4, 16 or 256 are the most common cases. These limits are often imposed by the target architecture's display adapter hardware, so it is not a coincidence that those numbers are exact powers of two (the binary code): 22 = 4, 24 = 16 and 28 = 256. While 256 values can be fit into a single 8-bit byte (and then a single indexed color pixel also occupies a single byte), pixel indices with 16 (4-bit, a nibble) or fewer colors can be packed together into a single byte (two nibbles per byte, if 16 colors are employed, or four 2-bit pixels per byte if using 4 colors). Sometimes, 1-bit (2-color) values can be used, and then up to eight pixels can be packed into a single byte; such images are considered binary images (sometimes referred as a bitmap or bilevel image) and not an indexed color image.

Color depth
  • 1-bit monochrome
  • 8-bit grayscale
  • 8-bit color
  • 15/16-bit color (High color)
  • 24-bit color (True color)
  • 30/36/48-bit color (Deep color)
Related
  • Indexed color
  • Palette
  • RGB color model
  • Web-safe color

If simple video overlay is intended through a transparent color, one palette entry is specifically reserved for this purpose, and it is discounted as an available color. Some machines, such as the MSX series, had the transparent color reserved by hardware.

Indexed color images with palette sizes beyond 256 entries are rare. The practical limit is around 12-bit per pixel, 4,096 different indices. To use indexed 16 bpp or more does not provide the benefits of the indexed color images' nature, due to the color palette size in bytes being greater than the raw image data itself. Also, useful direct RGB Highcolor modes can be used from 15 bpp and up.

If an image has many subtle color shades, it is necessary to select a limited repertoire of colors to approximate the image using color quantization. Such a palette is frequently insufficient to represent the image accurately; difficult-to-reproduce features such as gradients will appear blocky or as strips (color banding). In those cases, it is usual to employ dithering, which mixes different-colored pixels in patterns, exploiting the tendency of human vision to blur nearby pixels together, giving a result visually closer to the original one.

Here is a typical indexed 256-color image and its own palette (shown as a rectangle of swatches):

Read more about this topic:  Indexed Color

Famous quotes containing the words palette and/or size:

    I have heard that hysterical women say
    They are sick of the palette and fiddle-bow,
    Of poets that are always gay,
    William Butler Yeats (1865–1939)

    For truly I tell you, if you have faith the size of a mustard seed, you will say to this mountain, ‘Move from here to there,’ and it will move; and nothing will be impossible for you.
    Bible: New Testament, Matthew 17:20.