HOME

TheInfoList



OR:

In
computer graphics Computer graphics deals with generating images with the aid of computers. Today, computer graphics is a core technology in digital photography, film, video games, cell phone and computer displays, and many specialized applications. A great de ...
, a palette is the set of available colors from which an image can be made. In some systems, the palette is fixed by the hardware design, and in others it is dynamic, typically implemented via a color lookup table (CLUT), a correspondence table in which selected colors from a certain
color space A color space is a specific organization of colors. In combination with color profiling supported by various physical devices, it supports reproducible representations of colorwhether such representation entails an analog or a digital represen ...
's color reproduction range are assigned an index, by which they can be referenced. By referencing the colors via an index, which takes less information than needed to describe the actual colors in the color space, this technique aims to reduce data usage, including processing, transfer bandwidth, RAM usage, and storage. Images in which colors are indicated by references to a CLUT are called
indexed color In computing, indexed color is a technique to manage digital images' colors in a limited fashion, in order to save computer memory and file storage, while speeding up display refresh and file transfers. It is a form of vector quantization comp ...
images.


Description

As of 2019, the most common image colorspace in
graphics card A graphics card (also called a video card, display card, graphics adapter, VGA card/VGA, video adapter, display adapter, or mistakenly GPU) is an expansion card which generates a feed of output images to a display device, such as a computer mo ...
s is the
RGB color model The RGB color model is an additive color model in which the red, green and blue primary colors of light are added together in various ways to reproduce a broad array of colors. The name of the model comes from the initials of the three ad ...
with 8 bits per pixel
color depth Color depth or colour depth (see spelling differences), also known as bit depth, is either the number of bits used to indicate the color of a single pixel, or the number of bits used for each color component of a single pixel. When referring ...
. Using this technique, 8 bits per pixel are used to describe the
luminance Luminance is a photometric measure of the luminous intensity per unit area of light travelling in a given direction. It describes the amount of light that passes through, is emitted from, or is reflected from a particular area, and falls with ...
level in each of the RGB channels, therefore 24 bits fully describe the color of each pixel. The full system palette for such hardware therefore has 224 colors. The objective of the usage of smaller palettes via CLUTs is to lower the number of bits per pixel by reducing the set of possible colors that are to be handled at once (often using adaptive methods). Each possible color is assigned an index, which allows each color to be referenced using less information than needed to fully describe the color. An example is the 256-color palette commonly used in the GIF file format, in which 256 colors to be used to represent an image are selected from the whole 24 bit color space, each being assigned an 8 bit index. This way, while the system can potentially reproduce any color in the RGB color space (as long as the 256 color restriction allows), the storage requirement per pixel is lowered from 24 to 8 bits per pixel.


Master palette

In an application showing many different image thumbnails in a mosaic on screen, the program may not be able to load all the adaptive palettes of every displayed image thumbnail at the same time in the hardware color registers. A solution is to use a unique, common '' master palette'' or ''universal palette'', which can be used to display with reasonable accuracy any kind of image. This is done by selecting colors in such way that the master palette comprises a full
RGB color space An RGB color space is any additive color space based on the RGB color model. An RGB color space is defined by chromaticity coordinates of the red, green, and blue additive primaries, the white point which is usually a standard illuminant, an ...
"in miniature", limiting the possible levels that the red, green and blue components may have. This kind of arrangement is sometimes referred as a ''uniform palette''. The normal
human eye The human eye is a sensory organ, part of the sensory nervous system, that reacts to visible light and allows humans to use visual information for various purposes including seeing things, keeping balance, and maintaining circadian rhythm. ...
has sensibility to the three primary colors in different degrees: the more to the green, the less to the blue. So RGB arrangements can take advantage of this by assigning more levels for the green component and fewer to the blue. A master palette built this way can be filled with up to , but this does not leave space in the palette for reserved colors, color indices that the program could use for special purposes. It is more general to use only (as in the
Web colors Web colors are colors used in displaying web pages on the World Wide Web, and the methods for describing and specifying those colors. Colors may be specified as an RGB triplet or in hexadecimal format (a ''hex triplet'') or according to their ...
case), or , which leaves room for some reserved colors. Then, when loading the mosaic of image thumbnails (or other heterogeneous images), the program simply maps every original indexed color pixel to its most approximated in the master palette (after dumping this into the hardware color registers), and writes the result in the video buffer. Here is a sample of a simple mosaic of the four image thumbnails using a master palette of 240 RGB arranged colors plus 16 additional intermediate shades of gray; all images are put together without a significant loss of color accuracy: :


Adaptive palette

When using
indexed color In computing, indexed color is a technique to manage digital images' colors in a limited fashion, in order to save computer memory and file storage, while speeding up display refresh and file transfers. It is a form of vector quantization comp ...
techniques, real life images are represented with better fidelity to the truecolor original one by using adaptive palettes (sometimes spelled ''adaptative palettes''), in which the colors are selected or quantized through some algorithm directly from the original image (by picking the most frequent colors). This way, and with further
dithering Dither is an intentionally applied form of noise used to randomize quantization error, preventing large-scale patterns such as color banding in images. Dither is routinely used in processing of both digital audio and video data, and is often ...
, the indexed color image can nearly match the original. But this creates a heavy dependence between the image
pixel In digital imaging, a pixel (abbreviated px), pel, or picture element is the smallest addressable element in a raster image, or the smallest point in an all points addressable display device. In most digital display devices, pixels are the ...
s and its adaptive palette. Assuming a limited 8-bit depth graphic display, it is necessary to load a given image's adaptive palette into the color hardware registers prior to loading the image surface itself into the
frame buffer A framebuffer (frame buffer, or sometimes framestore) is a portion of random-access memory (RAM) containing a bitmap that drives a video display. It is a memory buffer containing data representing all the pixels in a complete video frame. Mode ...
. To display different images with different adaptive palettes, they must be loaded one by one, as in a
slideshow A slide show (slideshow) is a presentation of a series of still images ( slides) on a projection screen or electronic display device, typically in a prearranged sequence. The changes may be automatic and at regular intervals or they may be manu ...
. Here are samples of four different indexed color images with color patches to show their respective (and largely incompatible) adaptive palettes: :


Transparency in palettes

A single palette entry in an
indexed color In computing, indexed color is a technique to manage digital images' colors in a limited fashion, in order to save computer memory and file storage, while speeding up display refresh and file transfers. It is a form of vector quantization comp ...
image can be designated as a ''transparent'' color, in order to perform a simple
video overlay {{Distinguish, on-screen display Video overlay is any technique used to display a video window on a computer display while bypassing the chain of CPU to graphics card to computer monitor. This is done in order to speed up the video display, and it ...
: 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 Software is a set of computer programs and associated documentation and data. This is in contrast to hardware, from which the system is built and which actually performs the work. At the lowest programming level, executable code consist ...
. 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 A pointing device is a human interface device that allows a user to input spatial (i.e., continuous and multi-dimensional) data to a computer. CAD systems and graphical user interfaces (GUI) allow the user to control and provide data to ...
is designed over an orange background, so here the orange areas denoted the transparent areas (left). At runtime, 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. 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 The Commodore 64, also known as the C64, is an 8-bit home computer introduced in January 1982 by Commodore International (first shown at the Consumer Electronics Show, January 7–10, 1982, in Las Vegas). It has been listed in the Guinness W ...
, MSX and
Amiga Amiga is a family of personal computers introduced by Commodore International, Commodore in 1985. The original model is one of a number of mid-1980s computers with 16- or 32-bit processors, 256 KB or more of RAM, mouse-based GUIs, and sign ...
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 An Image file format is a file format for a digital image. There are many formats that can be used, such as JPEG, PNG, and GIF. Most formats up until 2022 were for storing 2D images, not 3D ones. The data stored in an image file format may be ...
as GIF natively support 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 The BMP file format, also known as bitmap image file, device independent bitmap (DIB) file format and bitmap, is a raster graphics image file format used to store bitmap digital images, independently of the display device (such as a graphics ad ...
reserves space for Alpha channel values in its Color Table,MSDN. "RGBQUAD Color Table Entry"
/ref> however currently this space is not being used to hold any translucency data and is set to zero. By contrast, PNG supports alpha channels in palette entries, enabling semi-transparency in paletted images. 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 Desktop publishing (DTP) is the creation of documents using page layout software on a personal ("desktop") computer. It was first used almost exclusively for print publications, but now it also assists in the creation of various forms of online ...
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 In geometry, the minimum or smallest bounding or enclosing box for a point set in dimensions is the box with the smallest measure (area, volume, or hypervolume in higher dimensions) within which all the points lie. When other kinds of measure ...
for irregular text arrangement around the image's subjects. 2-D painting programs, like
Microsoft Paint Microsoft Paint is a simple raster graphics editor that has been included with all versions of Microsoft Windows. The program opens and saves files in Windows bitmap (BMP), JPEG, GIF, PNG, and single-page TIFF formats. The program can be in c ...
and
Deluxe Paint Deluxe Paint, often referred to as ''DPaint'', is a bitmap graphics editor created by Dan Silva for Electronic Arts and published for the then-new Amiga 1000 in November 1985. A series of updated versions followed, some of which were ported ...
, can employ the user designated ''background color'' as the transparent color when performing
cut, copy, and paste In human–computer interaction and user interface design, cut, copy, and paste are related commands that offer an interprocess communication technique for transferring data through a computer's user interface. The ''cut'' command removes t ...
operations. Although related (due to they are used for the same purposes), image bit masks and
alpha channel In computer graphics, alpha compositing or alpha blending is the process of combining one image with a background to create the appearance of partial or full transparency. It is often useful to render picture elements (pixels) in separate pas ...
s are techniques which do not involve the use of palettes nor transparent color at all, but off-image added extra binary data layers.


Software palettes


Microsoft Windows

Microsoft Windows Windows is a group of several proprietary graphical operating system families developed and marketed by Microsoft. Each family caters to a certain sector of the computing industry. For example, Windows NT for consumers, Windows Server for ...
applications manage the palette of 4-bit or 8-bit indexed color display devices through specialized functions of the
Win32 API The Windows API, informally WinAPI, is Microsoft's core set of application programming interfaces (APIs) available in the Microsoft Windows operating systems. The name Windows API collectively refers to several different platform implementations th ...
. The applicability of palettes in
Highcolor High color graphics is a method of storing image information in a computer's memory such that each pixel is represented by two bytes. Usually the color is represented by all 16 bits, but some devices also support 15-bit high color. More recentl ...
and Truecolor display modes becomes questionable. These APIs deals with the so-called "system palette" and with many "logical palettes". The "system palette" is a copy in
RAM Ram, ram, or RAM may refer to: Animals * A male sheep * Ram cichlid, a freshwater tropical fish People * Ram (given name) * Ram (surname) * Ram (director) (Ramsubramaniam), an Indian Tamil film director * RAM (musician) (born 1974), Dutch * ...
of the color display's hardware registers, primarily a physical palette, and it is a unique, shared common resource of the system. At boot, it is loaded with the default system palette (mainly a "master palette" which works well enough with most programs). When a given application intends to output colorized graphics and/or images, it can set their own "logical palette", that is, its own private selection of colors (up to 256). It is supposed that every graphic element that the application tries to show on screen employs the colors of its logical palette. Every program can manage freely one or more logical palettes without further expected interference (in advance). Before the output is effectively made, the program must ''realize'' its logical palette: The system tries to match the "logical" colors with "physical" ones. If an intended color is already present in the system palette, the system internally maps the logical to the system palette indexes (because they rarely coincide). If the intended color is not present yet, the system applies an internal algorithm to discard the least-used color in the system palette (generally, one used by another window in the background) and substitutes it with the new color. Due to there being limited room for colors in the system palette, the algorithm also tries to remap similar colors together and will always avoid creating redundant colors. The final result depends on how many applications are trying to show their colors on screen at the same time. The foreground window is always favored, so background windows may behave in different ways: from become corrupted to quickly redraw themselves. When the system palette changes, the system triggers a specific
event Event may refer to: Gatherings of people * Ceremony, an event of ritual significance, performed on a special occasion * Convention (meeting), a gathering of individuals engaged in some common interest * Event management, the organization of ev ...
to inform every application. When received, a window can quickly redraw itself using a single Win32 API function. But this must be done explicitly in the program code; hence the fact that many programs fail to handle this event, and their windows will become corrupt in this situation. An application can force the system palette to be loaded with specific colors (even in a specific order), "tricking" the system by telling it they are color entries intended for animation (quick color changes of the colors in the physical palette at specific entries). The system will then assume that those hardware palette entries no longer are free for its palette color management algorithm. The final result depends on the skills of the color-forcing program and the behavior of the other programs (although this problem is the same as in the regular case), and that of the operating system itself.


See also

*
List of color palettes This article is a list of the color palettes for notable computer graphics, terminals and video game console hardware. Only a sample and the palette's name are given here. More specific articles are linked from the name of each palette, for the ...


Notes


References

* Julio Sanchez and Maria P. Canton (2003).
The PC Graphics Handbook.
' CRC Press. .
Color palettes at Microsoft Developer Network (MSDN)

The RGBQUAD color table entry in BITMAPINFO structure at Microsoft Developer Network (MSDN)
{{DEFAULTSORT:Palette (Computing) Computer graphics data structures Color depths Computing output devices Articles containing video clips