Palette (computing) - Transparent Color in Palettes

Transparent Color in Palettes

See also Transparency (graphic)

A single palette entry in an indexed color image can be designated as a transparent color, in order to perform a simple video overlay: superimposing a given image over a background in such way that some part of the overlapped image obscures the background and the remaining not. Superimposing film/TV titles and credits is a typical application of video overlay.

In the image to be superimposed (indexed color is assumed), a given palette entry plays the role of the transparent color. Usually the index number 0, but other may be chosen if the overlay is performed by software. At design time, the transparent color palette entry is assigned to an arbitrary (usually distinctive) color. In the example below, a typical arrow pointer for a pointing device is designed over an orange background, so here the orange areas denoted the transparent areas (left). At run time, the overlapped image is placed anywhere over the background image, and it is blended in such way that if the pixel color index is the transparent color, the background pixel is kept, otherwise it is replaced. The result is an image with irregular shapes perfectly placed over the background (right).

NOTE: this is merely an example. No actual use in a given operating system must be inferred.

This technique is used for pointers, in typical 2-D videogames for characters, bullets and so on (the sprites), video titling and other image mixing applications.

Some early computers, as Commodore 64, MSX and Amiga supports sprites and/or full screen video overlay by hardware. In these cases, the transparent palette entry number is defined by the hardware, and it used to be the number 0.

Some indexed color image file formats as GIF and PNG natively supports the designation of a given palette entry as transparent, freely selectable among any of the palette entries used for a given image.
The BMP file format reserves space for Alpha channel values in its Color Table, however currently this space is not being used to hold any translucency data and is set to zero.

When dealing with truecolor images, some video mixing equipment can employ the RGB triplet (0,0,0) (no red, no green, no blue: the darkest shade of black, sometimes referred as superblack in this context) as the transparent color. At design time, it is replaced by the so-called magic pink. The same way, typical desktop publishing software can assume pure white, RGB triplet (255,255,255) from photos and illustrations to be excluded in order to let the text paragraphs to invade the image's bounding box for irregular text arrangement around the image's subjects.

2-D painting programs, like Microsoft Paint and Deluxe Paint, can employ the user designated background color as the transparent color when performing cut, copy, and paste operations.

Although related (due to they are used for the same purposes), image bit masks and alpha channels are techniques which not involve the use of palettes nor transparent color at all, but off-image added extra binary data layers.

Read more about this topic:  Palette (computing)