Digitizing Pictures How to Convert Pictures into Numbers
Digitizing Pictures How to Convert Pictures into Numbers
Digitizing Pictures � We already know how to represent numbers in binary. � Divide the picture into very small squares (pixels) and determine the color of each pixel. � Pixel: a “picture element”—a dot � Assign a number to each color and use the binary representation of that number and you are done!
Digitizing Pictures: Options � Two things affect picture quality: � Resolution: number/size of pixels ◦ More pixels = more numbers = more memory. � Number of colors: ◦ More colors = more numbers = more memory.
Elvis Line Art 100% This is a picture of Elvis made up of only 2 colors: black and white.
Elvis Line Art 800% Same picture at 800%. Each pixel is outlined in black.
Elvis Line Art 1600% Same picture at 1600%. Pixel structure is obvious.
Elvis as zeros and ones: � Same picture at 1600%. Pixel structure is obvious. You can actually see the eye!.
Elvis Gray Scale (256 shades) Same picture in “gray scale” – 256 shades of gray. Each pixel is represented by an 8 -bit number in the range from 0 [black] to 255 [white]. Note the shades of gray.
Gray Scale
Elvis Gray Scale 800%
Elvis Gray Scale 1600%
Elvis 8 -bit color (GIF) Elvis in 8 -bit color. Skin colors are not as smooth as with 24 -bit color.
Elvis 8 -bit color 800% Same picture at 800%.
Elvis 8 -bit color 1600% Same picture at 1600%.
Elvis 24 -bit color 100% Same picture in 24 -bit color: 8 bits for red, 8 bits for green, and 8 bits for blue. Total possible colors is 256 x 256, or over 16 million. Also called “True Color”. Gives photo-quality displays. True Color: 24 -bits, 16 million colors
Elvis 24 -bit color 800% Same picture at 800%. Pixels are outlined in black.
Elvis 24 -bit color 1600% Same picture at 1600%. Pixel structure is obvious.
Graphic Memory Requirements � 16 million colors: ◦ Elvis 24 -bit color BMP 127 KB (each pixel is represented by 3 bytes – no compression) ◦ Elvis 24 -bit color JPG 16 KB (each pixel is represented by 3 bytes, but with “lossy” compression). � Lossy compression: the picture viewed is not the same pixels as the original. Pixels have been lost.
Lossy Compression � Original After 40 saves
Graphic Memory Requirements � 256 colors: ◦ Elvis 8 -bit color BMP 44 KB (each pixel is represented by a single byte, no compression) ◦ Elvis 8 -bit color GIF 37 KB (each pixel is represented by a single byte, with “lossless” compression) � Lossless compression: the picture is compressed, but when viewed, all of the original pixels are there.
Side-by-side comparison 2 colors 256 shades 256 colors of gray 16 M colors
24 -bit (top) vs. 8 -bit color
Comparison: ` 24 -bit color Gray scale 8 -bit color 1 -bit line art
Conclusion: � Pictures look better if you have: ◦ More pixels (higher resolution) �This requires more memory. ◦ More colors �This requires more memory.
Paint. NET � Web is an open-source image editor site: http: //www. getpaint. net/
The End
- Slides: 26