190 likes | 202 Views
Learn how computers handle graphic objects, the differences between bitmap and vector files, and common graphic file formats.
E N D
In 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 By Netbalone - www.netbalone.com
Handling 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 By Netbalone - www.netbalone.com
Pixel Bitmap 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 By Netbalone - www.netbalone.com
To have a better understanding of bitmap graphics, let’s start with the simplest type of bitmap picture - Monochrome (i.e. B&W) Bitmap By Netbalone - www.netbalone.com
B&W Bitmap Graphics • A pixel can be Black or white (2 states) • So, 1 bit can be used to code the color 1111111111111 1111111111111 0001111111111 1011111111111 1100011111111 1111000111111 1111110111111 1111111000011 1111111111001 1111111111110 1111111111110 1111111111111 1 - White 0 - Black By Netbalone - www.netbalone.com
B&W 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 By Netbalone - www.netbalone.com
110 111 100 101 010 011 001 000 Grayscale 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 By Netbalone - www.netbalone.com
256 colors Bitmap Graphics How many bits are necessary to represent 256 colors in each pixel? 8 bits By Netbalone - www.netbalone.com
Question: • 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 By Netbalone - www.netbalone.com
Vector Graphics • A vector graphic is divided into objects • Each object is defined by the method of drawing it This picture contains 3 objects:a line, a circle and a rectangle By Netbalone - www.netbalone.com
Fill color Radius Line color Line thickness Center How 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! By Netbalone - www.netbalone.com
Advantages 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 By Netbalone - www.netbalone.com
Common Graphic File Format Bitmap (.bmp) - a common graphic file format;can 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!) By Netbalone - www.netbalone.com
Jpeg Format (5kB) Gif Format (26kB) By Netbalone - www.netbalone.com
Comparison Table: By Netbalone - www.netbalone.com
How 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. By Netbalone - www.netbalone.com
RGB 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 By Netbalone - www.netbalone.com
Example: Http://www.phy.ntnu.edu.tw/~hwang/image/rgbColor.html • 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 By Netbalone - www.netbalone.com
CMYK Color Scheme • For printing, publisher will find CMYK scheme more suitable for ink used. • CMYK represents 4 colors: Cyan, Magenta, Yellow and blacK. By Netbalone - www.netbalone.com