Fundamentals of Computer Graphics

Module D20c

Contents

Wherever you see this separator line in the document, clicking on it will return you to the Contents.

Overview


Computers weren't designed to show pictures. They were designed to compute. 

When computer storage was designed, it was intended for numbers, and only numbers. That fact hasn't changed at all during the 60+ years that computers have been in use. 

So how do we get pictures in them? How is it possible that computers have become the leading tool for artists?

The answer is that ingenious people thought of a way to store pictures as numbers. This module explains in basic terms how this is done.

The Basics: Bits and Pixels

How Computers Store Everything 


The main reason why computers have been so successful is that they are based on very simple ideas. In order to keep parts inexpensive and operation reliable, the fundamental unit of storage on a computer is a simple on/off switch. Because an on/off switch can have two positions, and because computers were designed to do arithmetic, the Off position is interpreted as the number Zero, and the On position is intepreted as One. Very simple. 

bits  An on/off switch used this way is called a bit. That's because the numbers zero and one are the digits (number symbols) of the binary (base 2) number system. The words were put together and shortened: Binary+digIT = BIT
bytes  Because most people are interested in numbers larger than 1, several bits have to be put together to form bigger numbers. They are usually combined in groups of 8 bits called a byte. (For a little more information about computer storage, see the "Data Storage Principles" module, G15c.)

How Computers Display Pictures 


Very early in the history of computers, people realized that in order to display many kinds of output - text in different languages, mathematical and chemical symbols, diagrams and illustrations - the computer's output displays should work by building up little tiny dots. For standard symbols like letters and numbers, the computer could output a predefined pattern of dots; to represent diagrams and pictures, it could put the dots together in special ways.
The dots came to be called pixels, from picture elements.

This illustration shows a "happy face" magnified so you can see the individual pixels. (How many pixels are used to make up the eyes?)

Getting the Details: Resolution

Precision of Detail is Resolution



One of the main things that determines how "good" a picture looks, is how much detail you can see in it. If not much details is visible, a picture looks either fuzzy or crude. When a picture is built up of many dots, the size of each dot and how close it is to its neighbor is the most important factor in determining precision and detail.
  • A sharp, clear picture is said to have high resolution ("high-res")
  • An image that is blocky or fuzzy is low resolution ("low-res")

?


Besides computers, what are some other visual media that use spots of light or color to show images? Are they "high-res" or "low-res"?

Measuring Resolution


There are two common ways to measure resolution: 
  • Dots Per Inch (DPI)
  • Pitch
Dots Per Inch is simply the number of pixels in one linear inch. For example, a common resolution on computer monitor screens is 72 DPI.

Pitch is the distance between the center of one pixel and the next. Inexpensive monitors have a pitch of .28mm, while the more expensive models have .25mm pitch - that is, 4 pixels in each millimeter.

?



Given that there are 25.4 millimeters in an inch, use a calculator to figure out:
 
How many DPI is a: .25mm pitch monitor?  (1/.25) * 25.4 = 101.6
How many DPI is a: .28mm pitch monitor?  (1/.28) * 25.4 = 90.7

Adding Color

Color: A Quick Review



What we perceive as color is electromagnetic radiation in a particular area of the spectrum which we call "visible light". 
  • The longest wavelength of visible radiation appears as "red"
  • The shortest is "violet"
  • All the colors of the rainbow lie between these extremes
  • When no light reaches our eyes, we say it is "black"
  • When light with an even mixture of all the wavelengths reaches our eyes, we say it is "white"


When people want to produce images, we produce colors in one of three basic ways. 

  1. Originally, colors were made by putting a colored substance (such as paint or ink) on a surface. The substance is colored because when white light hits it, only certain wavelengths of light are reflected back.
  2. Another way of making colors is to shine white light through a transparent substance (such as glass, plastic, or film). The substance transmits only part of the visible spectrum of light.
  3. Recently, people have learned how to directly generate light of specific wavelengths. This is done with cathode ray tubes, lasers, and similar light generators.

Color on TV Screens



Color on TV screens (cathode ray tubes) is produced by shooting a beam of electrons at a screen coated with phosphors - materials such as zinc sulphide that emit light in specific wavelengths when they are "hit" by electrons. 

By combining three wavelengths of light - red, green, and blue, all parts of the visible spectrum can be created.

Color on Early Computers



All computers (as we mentioned before) use bits to store numbers. Early computer screens, which used the cathode ray tube (CRT) principle, showed only black and one other color (green, blue-white, and orange were the most common) They were monochrome ("one-color") screens. Likewise, computer printers were made to print using black dots on white paper.

The principle for storing monochrome images was simple: 

1 pixel in the image = 1 bit in the computer

In other words, an image was stored by taking the pixels that were bright ("turned on") on the screen, and representing them by bits that were "turned on" (= 1) in the computer.

Bit off = 0 Bit on = 1
Black Color

The pattern of on-off bits in the computer's memory could then be mapped directly to a screen or printer. This is called a bit-mapped image.

Computer Color Evolves



Humans are built to respond quickly and easily to colors - we get a lot of information from our environment through colors. People soon began to tire of monochrome screens, and the potential for conveying information through color on computer screens led to the development of color storage systems on computers.

The original principle used was based on the fact that CRT screens use Red, Green, and Blue (RGB) as "primary colors" to create the entire spectrum of visible light. Most computer color systems were developed based on this principle:

1 primary color in a pixel = 1 bit in the computer

This means that at least 3 bits were needed to represent the spectrum, and the CRT's electronics are controlled in a very simple way by having each bit turn on (1) or off (0) the color for one of the three electron streams at a given spot on the screen.

Bit Color
Red
Green
Blue
Black
0
0
0
Red
1
0
0
Green
0
1
0
Blue
0
0
1
Yellow
1
1
0
Magenta
1
0
1
Cyan
0
1
1
White
1
1
1

In the most common system, a fourth bit was added to represent the brightness of a pixel (on = birght, off = dim). This combination gave 16 possible colors by controlling the brightness of each of the three colors.
 

Color
Bright on
 
Red
Green
Blue
 
Bright off
Color
Dark Grey
1
 
0
0
0
 
0
Black
Red
1
 
1
0
0
 
0
Maroon
Green
1
 
0
1
0
 
0
Sea
Blue
1
 
0
0
1
 
0
Indigo
Yellow
1
 
1
1
0
 
0
Brown
Magenta
1
 
1
0
1
 
0
Purple
Cyan
1
 
0
1
1
 
0
Teal
White
1
 
1
1
1
 
0
Light grey

Computer Color Today


Though the 16-color system was a great leap beyond monochrome, it was very crude for representing images of artwork or photographs.

The biggest barrier to representing "true color" has always been the cost of moving and storing large numbers of pixels.

As the cost of storage and rapid movement of bits lowered, we became able to store more and more colors, so that photographs and gradients can now be represented quite well.

Today's system represents "millions of colors" by representing each of the three "primary" colors with 8 bits. This gives 2 raised to the 8th power shades of each color, from dark (0) to brightest (255). Combined, we get 2 raised to the 24th power, or 16,777,216 colors!

However: not all sixteen million are safe to use on the Web! Only 216 can be relied on...more about this later.

 

Storing Images

The Problem

The method of representing colors described above is basic for displaying images on all computers. But there's a problem: for each pixel, at least 24 bits of storage are used. For a 3 by 5 inch photograph, at 72 bits per inch, 1,866,240 bits of storage are needed. That's 233,280 bytes: quite a lot considering the picture isn't very big or very high resolution.

There's another problem: suppose, instead of working with photographs, you're working with diagrams such as blueprints or graphs. When you want to change the layout or the proportions, the bit mapping system makes it necessary to move a lot of these bits around.

The Solution


Rather than trying to store and display pictures the way they are displayed on a screen, several more practical ways of storing images have been developed using clever mathematical techniques.

  • Compression techniques have been developed to squeeze images into smaller spaces without losing too much detail. This is useful for storing large images and transmitting them over the Internet.
  • If you are interested in shapes and objects rather than shades and areas of color, the shapes can be represented using mathematical geometry. This is useful for storing diagrams, blueprints, and graphs.

Two Fundamental Image Representations


This leads to two funadmentally different ways of storing images: bitmap and vector.

  • Bitmap images are stored (basically) the way they are displayed: each pixel in the image is "mapped to" one or more bits in the computer. This is good for photos and artwork.
    Other names for bitmap images:
    you may see these referred to as raster graphics or paint images
  • Vector graphics are stored using the coefficients of geometrical equations which represent the shapes of objects and their relationship to one another. This is good for diagrams, typography, graphs, and blueprints. Vector graphics are displayed by calculating the positions of pixels in the image and mapping them to bits in the screen display unit.
    Other names for vector graphics: you may see these referred to as draw images.

Summary: The Trade-offs

 

For every detail of an image stored in a computer, there is a cost: the more details you want, the more storage space it will require.

The choice between vector graphics and bitmaps also represents a tradeoff: with vector graphics, more space is required for complex shapes and for little spots of color. Bitmap images make it difficult to preserve the integrity of shapes and individual objects.

For each of these trade-offs, the professional needs to know how to balance the advantages and disadvantages to achieve maximum quality in minimum space. That is the secret of success for good computer graphics!

About this document...

Review:
Click here for module review questions. 

Audience:

This is for people who want to understand the fundamental principles of computer graphics.

Objectives:

When you successfully complete this lesson, you will be able to...
  1. Explain how computers display images
  2. Define pixel
  3. Define resolution
  4. Explain measures of resolution: pitch, dots per inch (DPI)
  5. Explain bit mapping
  6. Explain the concept of color depth
  7. List the number of colors mapped by numbers of bits commonly used in bit mapping
  8. Discuss the two fundamental methods by which which images can be stored on computers
  9. Explain the fundamental trade-offs involved in representing quality images on a computer

Module D20c:

This document is part of a modular instruction series in Computer Information Systems. For more information, see the overview or the list of modules in this series, D: Desktop Publishing and Computer Graphics. This document has been used in the following classes: INP 143

Author:

Laurence J. Krieg

Institution:

Internet Professional Department, Washtenaw Community College
History: Original: 24 May 2000
Last modification: Tuesday, 17-Feb-2004 12:39:03 EST
Copyright: Copyright © 2000, Laurence J. Krieg.
Instructors: You may point to this file in your Web-based materials.
Students: you may make a copy for your personal use.
All other uses: contact the author, Laurence J. Krieg for permission. Email krieg@ieee.org