Title: In this chapter, you will learn
1In this chapter, you will learn
- How computer handles graphic objects
- The differences between a bitmap file and a
vector file - The differences among different common graphic
file formats
2Handling Computer Graphics
- Computer Handles data in binary format 0 or 1
(bit)
28 256
216 65,535
224 16,777,216
232 4,294,967,296
3Bitmap Graphics
- A bitmap graphic is represented by a dot pattern
- Each dot is called a Pixel (picture element)
- A pixel has a single color only
4To have a better understanding of bitmap
graphics, lets start with the simplest type of
bitmap picture - Monochrome (i.e. BW) Bitmap
5BW Bitmap Graphics
- A pixel can be Black or white (2 states)
- So, 1 bit can be used to code the color
1111111111111 1111111111111 0001111111111 10111111
11111 1100011111111 1111000111111 1111110111111 11
11111000011 1111111111001 1111111111110 1111111111
110 1111111111111
1 - White 0 - Black
6BW Bitmap Graphics
- Therefore, a full screen (800 x 600) monochrome
bitmap picture requires storage of - (800 x 600 x 1) bits
- 480000 bits
- 60000 bytes
- 58.59 kB
7Grayscale Bitmap Graphics
- Grayscale graphics are created by using shades of
gray - 8 levels of grayscale
How many bits should be used to represent the
gray colors of each pixel?
3 bits
8256 colors Bitmap Graphics
- How many bits are necessary to represent 256
colors in each pixel?
8 bits
9Question
- How many bits are necessary to represent a 800 x
600 graphic of 256 colors?
Number of bits used 800 x 600 x 8 bits
3,840,000 bits
(Storage required 468.75 kB)
The larger the resolution and the no. of colors,
the more storage spaces are required to hold the
graphic
10Vector Graphics
- A vector graphic is divided into objects
- Each object is defined by the method of drawing
it
This picture contains 3 objectsa line, a circle
and a rectangle
11How to draw the circle?
- The circle is represented by a mathematical
formula
Circle(50,100,150,black,1,green)
A few bits is enough to save the properties of
this circle!
12Advantages of using Vector Graphics
- It requires less storage space
- When a vector graphic is enlarged, it remains
intact (no distortion)
Enlarging a Vector Graphic
The line is as smooth as before
Enlarging a Bitmap Graphic
The line thickened saw-tooth resulted
13Common Graphic File Format
- Bitmap (.bmp) - a common graphic file
formatcan be read by almost all programs - Gif (.gif) - a compressed bitmap file format. It
can support up to 256 colors - Jpeg (.jpg) - a lossy compressed bitmap file
format. But it can support up to 16.7 million
colors - (because it applies lossy compression, some of
the details is lost!) -
14Jpeg Format (5kB)
Gif Format (26kB)
15Comparison Table
16How colors are represented?
- 8-bit color means 28 256 different colors
- 16-bit (High) color means 216 65535 different
colors - 24-bit (True) color means 224 16777216
different colors
The number of bits used to represent colors is
called color depth.
17RGB Color Scheme
- All colors are made up of 3 primary colors of
light Red (R), Green (G) and Blue (B) - Different intensities of red, green and blue can
mix up different colors - In computer, 8 bits are used to represent 256
levels of each of these primary colors
18Example
Http//www.phy.ntnu.edu.tw/hwang/image/rgbColor.h
tml
- RGB(255,0,0) Red
- RGB(0,255,0) Green
- RGB(0,0,255)
- RGB(0,0,0)
- RGB(255,255,255)
- RGB(255,0,255)
Blue
Black
White
Magenta
19CMYK Color Scheme
- For printing, publisher will find CMYK scheme
more suitable for ink used. - CMYK represents 4 colors Cyan, Magenta, Yellow
and blacK.