Indexed Color
A browser may support only a certain number of specific colors, creating a palette from which to choose
1
Figure 3.11
The Netscape color palette
QUIZ
How many bits are needed to represent this palette?
Show your work.
2
How to digitize a picture
• Sample it → Represent it as a collection of individual dots called pixels
• Quantize it → Represent each pixel as one of 224 possible colors (TrueColor)
Resolution = The # of pixels used to represent a picture
3
Digitized Images and Graphics
4
Figure 3.12 A digitized picture composed of many individual pixels
Whole
picture
Digitized Images and Graphics
5
Figure 3.12 A digitized picture composed of many individual pixels
Magnified portion
of the picture
See the pixels?
Hands-on: paste the
high-res image from
the previous slide in
Paint, then choose
ZOOM = 800
QUIZ: Images
A low-res image has 200 rows and 300 columns of pixels.
• What is the resolution?
• If the pixels are represented in True-Color, what is the size of the file?
• Same question in High-Color
6
Two types of image formats
• Raster Graphics = Storage on a pixel-by-pixel
basis
• Vector Graphics = Storage in vector (i.e. mathematical) form
7
Raster Graphics
GIF format • Each image is made up of only 256 colors (indexed color –
similar to palette!)
• But they can be a different 256 for each image!
• Supports animation! Example
• Optimal for line art
PNG format (“ping” = Portable Network Graphics)
Like GIF but achieves greater compression with wider range of color depth
No animations
8
Bitmap format Contains the pixel color values of the image from left to right and from top to bottom
• Great candidate for run-length compression!
• Lossless, but files are large!
JPEG format Averages color hues over short distances
• Lossy compression
Optimal for color photographs
9
Vector Graphics
A format that describes an image in terms of lines and geometric shapes
A vector graphic is a series of commands that describe a line’s direction, thickness, and color
The file sizes tend to be smaller because not every pixel is described
Example: Flash
10
Vector Graphics
The good side:
Vector graphics can be resized mathematically and changes can be calculated dynamically as needed
The bad side:
Vector graphics are not good for representing real-world images
11
3.6 Representing Video
12
13
Representing Video
Video codec COmpressor/DECompressor Methods used to shrink the size of a movie to allow it to be played on a computer or over a network
Almost all video codecs use lossy compressions to minimize the huge amounts of data associated with video
QUIZ video
A 10-minute videoclip is shot in a resolution of 768x1024 True-Color pixels, and 24 frames/second.
• What is the uncompressed size of the video file?
• How long would it take to transmit it over a 100 Mbps Ethernet connection?
14
15
Representing Video
Temporal compression
A technique based on differences between consecutive frames: If most of an image in two frames hasn’t changed, why should we waste space to duplicate all of the similar information?
Spatial compression
A technique based on removing redundant information within a frame: This problem is essentially the same as that faced when compressing still images
Chapter Review Questions
• Distinguish between analog and digital information
• Explain data compression and calculate compression ratios
• Explain the binary formats for negative (two’s complement), fractional, and floating-point values
• Describe the characteristics of the ASCII and Unicode character sets
• Perform various types of text compression with pencil and paper: Keyword, Run-length, Huffman
16
Chapter Review Questions
• Explain the nature of sound and its representation
• Explain how RGB values define a color
• Distinguish between raster and vector graphics
• Explain temporal and spatial video compression
17
For next time:
--Read pages 69-75 of text
--Re-solve all today’s quizzes
Homework: 8,9,29,30,31,41,47,49,51,53, 61
--Due Friday, Feb.19
18 EOL6