Chapter Eight: Color and Images
Chapter Eight: Color and Images
In computer graphics, color and images are fundamental components that contribute to the visual
representation of digital content. The primary color model used in computer graphics is the RGB
model, which stands for Red, Green, and Blue. These three colors can be combined in various
ways to create a wide spectrum of colors. Here’s a breakdown of key concepts related to color
and images in computer graphics:
Color Representation
The RGB color model is a fundamental concept in computer graphics, widely used for
representing and displaying colors in digital devices. Here’s an overview of the RGB color
model, its workings, and its applications:
Definition: The RGB color model is an additive color model that combines three primary
colors: Red, Green, and Blue. By varying the intensity of these colors, a broad spectrum
of colors can be created.
Color Representation: Each primary color can take intensity values ranging from 0 (no
light) to 1 (full intensity) in normalized form, or from 0 to 255 in an 8-bit representation.
This allows for over 16 million possible colors when combining the three channels.
1
How It Works
Additive Mixing: The RGB model works on the principle of additive color mixing.
When light of different colors is combined, the resulting color is determined by the sum
of the light wavelengths. For example:
o Red (1, 0, 0) + Green (0, 1, 0) = Yellow (1, 1, 0)
o Blue (0, 0, 1) + Green (0, 1, 0) = Cyan (0, 1, 1)
o Red (1, 0, 0) + Blue (0, 0, 1) = Magenta (1, 0, 1)
o All three at full intensity (1, 1, 1) produce white, while (0, 0, 0) produces black
Red: In the RGB model, red is represented as (255, 0, 0), meaning full intensity of red with no
green or blue.
Yellow: Yellow is created by mixing red and green light. In RGB, yellow is represented as (255,
255, 0), which means full intensity of both red and green, with no blue.
When you mix red light (255, 0, 0) with yellow light (255, 255, 0), you are essentially combining
the light from both colors.
The resulting color will have the red component at full intensity (255) and the green component
from yellow (255), while the blue component remains at 0. Therefore, the mixed color will be
(255, 127.5, 0) if you consider equal parts of red and yellow light, resulting in a shade of orange.
Applications
Digital Displays: The RGB model is primarily used in electronic displays such as
monitors, televisions, and projectors. Each pixel on these devices is made up of subpixels
that emit red, green, and blue light, which combine to create the perceived color.
Image Processing: In digital photography and image editing, RGB values are used to
manipulate colors in images. Software applications often allow users to adjust the
intensity of each color channel to achieve desired effects.
2
Web Design: RGB is the standard color model for web design, where colors are specified
using hexadecimal codes or RGB values in CSS. This allows for precise control over the
appearance of web elements.
Limitations
Device Dependence: The RGB model is device-dependent, meaning that the same RGB
values can look different on various devices due to differences in display technology and
calibration. This can lead to inconsistencies in color representation across different
screens.
Not Perceptually Uniform: The RGB model does not represent colors in a way that
corresponds to human perception, which can make it challenging to predict how colors
will appear to viewers.
In summary, the RGB color model is essential for color representation in computer graphics,
enabling the creation and manipulation of a wide range of colors in digital media.
2. CMYK (Cyan-Magenta-Yellow-Black):
This is a subtractive color model used mainly in color printing. It works by subtracting
varying percentages of light absorbed by the inks. The model starts with white (the color
of the paper) and adds pigments to create darker colors. When combined, cyan, magenta,
and yellow inks ideally produce black, but black ink (K) is added to enhance depth and
detail in printed images.
In computer graphics, several 2D color models are commonly used to represent colors in digital
images and graphics. Here are some of the key 2D color models:
3
Additive Color Mixing
Definition: Additive color mixing occurs when different colors of light are combined. The
primary colors in this model are red, green, and blue (RGB).
How It Works: In the additive model, colors are created by adding light. For example,
combining red and green light produces yellow, while combining all three primary colors (red,
green, and blue) in equal intensity results in white light.
Applications: This model is primarily used in digital screens, such as monitors and televisions,
where colors are produced by the emission of light from pixels. Each pixel can vary the intensity
of red, green, and blue to create a wide spectrum of colors.
The additive color model is not typically used in printing inks. Instead, printing primarily relies
on the subtractive color model.
The CIE (Commission Internationale de l'Éclairage) has developed several color spaces that are
widely used in various applications. The most notable is the CIE 1931 color space, which is
based on human color perception. Here are some key aspects:
Tristimulus Values: The CIE 1931 color space uses three values, X, Y, and Z, to represent
colors. These values correspond to the responses of the three types of cone cells in the human
eye, which are sensitive to different wavelengths of light.
Chromaticity Diagram: This diagram visually represents colors based on their chromaticity (hue
and saturation). The perimeter of the diagram shows pure spectral colors, while the area within
the triangle formed by the primary colors (Red, Green, Blue) represents mixtures of these colors.
For example, a point in the diagram can represent a specific shade of purple created by mixing
red and blue light.
Applications: CIE color spaces are crucial in industries like printing and digital imaging,
ensuring consistent color reproduction across devices. For instance, a printer can use CIE values
to accurately reproduce colors that match those seen on a computer screen.
4
The diagram represents all of the chromaticities visible to the average person. · It is seen that all
visible chromaticities correspond to non-negative values
TGB Model
Tristimulus: Similar to the CIE model, TGB uses tristimulus values to describe colors based on
human perception.
Gamut: This refers to the range of colors that a device can reproduce. For example, a high-end
monitor may have a wider gamut than a standard monitor, allowing it to display more vibrant
colors.
Brightness: This component addresses the perceived luminance of colors, which is crucial for
creating realistic images. For instance, a bright yellow may appear more vibrant against a dark
background compared to a light one.