CS 248: Introduction to Computer Graphics

Pat Hanrahan

Grader: Pat Hanrahan

3. The following questions concern color tables.

3A. (5 points) What are the advantages of using a color-index image and displaying it with a hardware color table?


5 points for any reasonable answer

3B. (5 points) What might be some disadvantages?


5 points for any reasonable answer

3C. (5 points) Suppose an 8-bit in, 8-bit out, color table is used to gamma-correct an image. What problems might occur.

Gamma correction involves applying a non-linear function to color values (O=I^(1/gamma)). Since the range of the input and the output are the same (256 entries each), multiple input colors will map to the same output color, and thus there will be precision problems.


-2 points if you do not say "multiple inputs map to the same output" or equivalent.

3D. (10 points) Suppose you have a 24-bit RGB image. How might you convert it to an 8-bit color-index image? Describe two methods, comparing and contrasting them

Quantize the color value

  1. Uniformly quantize the color space by assigning a certain number of bits to R, G, and B. For example, 3-bits for R, 3-bits for G, and 2-bits for B.
  2. Pick any color table. Then for each color in the image, find the closest color to it in the color table and use the index of that color.
  3. Find the 256 most popular colors in the image, and then map each color in the image to one of these colors.
  4. Adaptively subdivide color space into 3-boxes, such that the number of pixels inside each box is equal. Then find the average color in each box and map all colors within that box to that color.

Apply a dithering or halftoning algorithms to the quantized colors to minimize the error.

Some comments on comparisons:


4 points for any reasonable method (8 points total)
2 points for correctly comparing them

Copyright © 1997 Pat Hanrahan