What is a color space? It is a way to represent
colors, usually used in relation to computers or graphics boards.
Note that "color" in this context includes levels of grey. This isn't
an advanced mathematical paper which discusses the topic, but is meant
as an overview of some of the common spaces.
I have had a personal interest in this since about 1984.
I began working part-time for a company which had an Earthviews Satellite
Image Analysis system. The graphics were in true color and driven
by a rack mounted box called the VDI (Video Display Interface). It
achieved the color resolution in just 14 bits per pixel (2 bits were used
for overlay panes).
As I learned more about this, I discovered that it was
using IHS (Intensity, Hue, Saturation; also known as HSValue,
HSI, or HIS). Out of the 14 bits, 6 were used for intensity, 5 for
hue (color), and 3 for saturation (degree of color purity). Somehow
in these 14 bits we were making great pictures that seemed indistinguishable
from the 24-bit pictures available on other systems.
How did they do that? Let us look at some of the color
spaces that have been and are available for computers now, and then we
will get back to IHS.
2 Bits, 4 Bits, 6 Bits, a Long Word!
1-bit color: Curiously we do not seem to have a commonly used
name for this simplest color space. Black and White has been
used incorrectly for so long meaning "grey scale" that it is unavailable
in its literal meaning. Likewise, monochrome has the meaning
of a scaled set of shades, not just black:white or amber:bright-amber.
So I am reduced to referring to this 1-bit color as "1-bit color" or maybe
"black or white", hoping someone notices the slight difference.
Sometimes the 2 colors were not even black and white; there were many terminals
sold that had either green or amber screens, which either had 2 shades
of green or 2 shades of amber.
Typically 1-bit color graphics were used in text only displays.
There were exceptions to this, such as the original Macintosh (which didn't
even have a text mode) and the original IBM MGA (monochrome graphics adapter,
which had a graphics mode in addition to the text mode). My first
computer, an Exidy
Sorcerer II, had a curious mixture. It was text mode, with 8x8
characters. But the upper 128 characters could be redefined in any
combination. This let the display seem to have a graphics mode, but
it was achieved with a very flexible text mode.
2-bit color: I think these existed, but I am not sure.
I know DEC terminals such as the VT-220 had a bright attribute, which gave
at least 3 shades (background, normal text, and bright text). If
this were implemented (in a non-color portable computer, for example),
there would be 4 total shades.
4-bit color: Here is where things started getting more interesting.
4-bit color was used by IBM EGA (enhanced graphics adapter) displays as
well as the Commodore 64 and 128 (and many others). These displays
used fixed, defined bits, which I call rgbi (one bit each for red,
green, and blue, as well as an intensity bit).
There are 16 combinations, including 4 shades of grey. They can even
DARK GREY BLUE
The Commodore Amiga and IBM VGA (video
graphics adapter) enhanced 4-bit color by allowing indexing.
There were still 16 colors at any one time, but the 16 colors could be
thought of as pens, with each pen having a redefinable color. So
a program could use a 16-level grey scale, or use the original 16 EGA colors
above, or choose any combination of colors that he wanted from a very large
palette of colors. The only restriction was that at any one time,
there could only be 16 used.
LIGHT GREEN CYAN
LIGHT RED PURPLE
YELLOW LIGHT GREY WHITE
The Amiga used a technique known
as bit planes, so it was no problem for them to support 5 bits allowing
32 indexed colors at any one time. At low resolution, they could
even have 6 bit planes, allowing unique effects such as dual playfields,
EHB (extra half-bright; 32 indexed colors at two intensities each), or
HAM (hold and modify; 6 bits controlling 4096 colors in a single image!).
They weren't tied to combinations of what would fit in a single 8-bit byte
8-bit color: When an image uses 8-bit color, it is most commonly
an indexed color. That is, the 256 combinations that can fit into
8 bits point to a larger color palette, usually from 24-bit color space
(8 bits each red, green, and blue). The image format or program typically
has free reign in choosing which 256 of the thousands or even millions
of colors available to use.
There are also fixed 8-bit color spaces. Some might
assign 3 bits to red and green, and 2 bits to blue (rrrgggbb), or
2 bits to each color, plus 2 intensity bits (rrggbbii). Using these
fixed colors is restrictive, but it does have one advantage on 8-bit color
display hardware. If each window has a different indexed color map,
then only one window at a time will look good as the mouse moves around
the screen. However, if all the windows are using the same fixed
color map, then all the windows can look fair all the time.
Eight bits also allows 256 shades of grey. The human
eye can probably discern about 85 intensity levels on a good monitor (high
dynamic range, which means the black is very black and the white
is very bright), so often indexed colors are used which give about 128
slots to grey, and the other 128 are divided among whatever colors are
necessary. Preserving all 256 shades may be useful when it is known
that there will be further image processing later or if your video monitor
is grey scale.
16-bit color: This is my personal favorite. It is a
natural data size for the cpu to work with, and the color precision closely
matches color accuracy. I.e., the images are smaller than 24-bit
images, but no visible color resolution is lost. It is also an extremely
flexible data size, allowing the following color spaces:
grey scale: Typically 10, 12, or 16 bits per pixel are used
on a grey scale film scanner. This is overkill for paper scanners,
but film really does have enough shade variances (density levels)
to warrant the extra precision.
cmyk: For the print industry, this assigns four bits each
to the ink colors cyan, magenta, yellow and black. I don't know whether
there really are printers that can accurately print 16 sizes of ink blobs,
but I assume there is mathematical and physical wizardry that goes in to
trade color resolution for geometric resolution. Allows for 256 shades
rrrrrggggg0bbbbb: This is also known as 15-bit
color. There are 5 bits each for red green and blue. This only
allows for 32 shades of grey. It also misses a large number of hues
and saturation levels that your eyes can discern and your monitor can represent.
rrrrrggggggbbbbb: This is a common way to handle
16-bit color. Five bits each are used for red and blue, and 6 bits
for green. The best that can be said for it is that it is better than
15-bit color. It also only represents 32 shades of grey (but 64 shades
rrrrggggbbbbiiii: Four bits each for red green and
blue, plus 16 intensities for each of the defined colors. This allows
for 256 shades of grey, in addition to the evenly spread out colors.
There are many distinguishable hues and saturation levels missing in this
color space, but for the ones it does represent, it has very good intensity
rrrrrgggggibbbbb: Of the
16-bit RGB formats, this is probably the best. It has 5 bits each
for red, green, and blue, plus an intelligently chosen intensity bit.
I discuss this more in my PNG-16 (Portable Network Graphics) proposal.
It has a 64 shades of grey.
24-bit color: Many people assume that this is the only kind
of "true color". On all video 24-bit devices that I know of, there
are 8 bits each assigned to red, green, and blue (RGB color space).
Thus there are only 256 intensity levels, even though people commonly refer
to "16 million colors". Don't try to count them; your eyes cannot
discern that many and your monitor cannot really show that many.
Still it makes great advertising copy!
Some graphics formats use CMY color space, with
8 bits each assigned to cyan, magenta, and yellow. The printing industry
frequently uses this because those are the colors of ink necessary to print
color (assuming black ink is not available). If 16 million colors
is an exaggeration for video, it is a gross exaggeration for print.
There is either a drop of ink in a certain spot or there is not.
Even if there were a controlled methodology where the press could have
16 sizes of of ink spots, that's still only 4096 total shades.
CMY is convenient color space in mathematical terms.
Cyan may be thought of as "not red", or "255 - red_intensity". Magenta
is "not green", or "255 - green_intensity". And, similarly yellow
is "not blue", or "255 - blue_intensity". In practice, though, video
images and print images are fundamentally different. Video imagery
has a large color resolution but low geometric resolution (typically 60
to 100 dots per inch). Print imagery is just the opposite; it has
a low color resolution (only hundreds of colors) but extremely high geometric
resolution ("magazine quality" is at least 1200 dots per inch). Your
eyes magically blend the ink spots, delivering to your brain an image in
32-bit color: This is basically a meaningless marketing ploy.
There are not 4 billion resolvable colors. Period. But if you
are the marketing person trying to sell your graphics board, would you
rather advertise "24 bits" or "32 bits"? Or if you worked for HP
or Cannon, would you rather sell a 24-bit scanner or a 30-bit scanner?
There are useful things that can be done with the extra
bits, but color resolution is not one of them. Here are some of the
useful things that can be done:
alpha channel: Typically 8 bits are used for some sort of
special effects. The underlying image can be masked (turned opaque),
embossed (made slightly darker), high-lighted (made slightly brighter),
annotated (with text or simple graphics), or whatever else some clever
person can think of to do with one image on top of another.
z channel: Add a third dimension (elevation) to each pixel
of the image.
gamma correction: Your monitor is not like your mother's.
Even if it is the same brand and same model number, the same picture driven
by the same graphics card will look slightly different. You can play
with the contrast and brightness controls and get an image to look the
same, but the next image might well look different again. Gamma
is the correction applied to the image data so that it looks the same on
both monitors (or prints the same on two printers).
There is a real world problem with gamma correction, although
it sounds great in theory. It has to be customized for your monitor
and your printer. As your monitor ages, the necessary gamma correction
values change, and a re-customization would be necessary. And if
your cousin Fred comes over and messes with your contrast and brightness
controls, you might as well forget that you paid 20% extra for the gamma
correction feature, because he just threw everything off.
cmyk: For printing, 8 bits each are assigned to cyan, magenta,
yellow, and black. While useful in principal, it has no advantage
over 4 bits each to the ink colors. Well, ok, in software it is easier
for a computer to work with whole bytes (8 bits) rather than half bytes
(nibbles), but the image takes up twice the disk space it needs
48-bit color: This is an available feature of the new PNG
image format. It can have 16 bits each for red, green, and blue.
While it is a natural extension of PNG's neat support for 16-bit imagery,
it is a case of precision far in excess of accuracy.
96-bit color: Every time a young Ph.D. invents a new image
format, he wants to use floating point numbers. So he has 32 bits
each for red, green, and blue. Eventually he realizes that nobody
but him is interested in his format, and if he is lucky, he gets a life.
While there is little use for floating-point-precision pixel brightnesses on a
graphics board or within an image file, such precision is useful when doing a
chain of image transforms. Thus useful 96-bit color spaces do exist, just
not as something end users are ever likely to mess with.
Color FAQ, with math symbols, and everything
Earl F. Glynn's
Color Library, with more links than you have time for
First published August 1998,
hits since 2004-04-05,
last modified 2010-11-21