The purposes of this lab are to get some hands-on experience with the GIF format and to provide some time to work on your final programming project.
You will complete this lab by following the directions below, filling out the Lab Form(s) for this lab when directed. The Lab Forms are Google Forms that save your answers.
Recall that GIF images are represented by storing a color value for each pixel (picture element) in the grid that makes up the image. Each value is a 24-bit color, with 8 bits for each component using (R,G,B) representation. For an image that is 100 pixels wide and 50 pixels high,
One way that GIF images are stored more efficiently is by limiting the number of distinct colors the image can contain. For instance, a typical number is 256 colors. Each distinct color is stored in a table, known as the Color Look-Up Table. Then, the color of each individual pixel can simply be stored as a number in the 0..255 range, rather than as a 24-bit color.
Record your answers on your lab sheet.
Another way that GIF images may be stored efficiently is by using run-length encoding to accomplish data compression. The simple idea of run-length encoding is to take advantage of long sequences in which the same data value is repeated. For instance, if color #7 appears 10 times in a row, the sequence 7 7 7 7 7 7 7 7 7 7 is replaced by the numbers 10 7.
In this exercise, our class will be assembling a model of a GIF image, using Post-It notes to represent the various pixels. Your teaching assistants will direct this activity.
Your teaching assistants will explain this exercise to you.
Examine the sheet you have been given. Find the part that says "Your Data". Discuss with your lab group:
Find the "quick lesson on data compression" at the bottom of the page. Discuss with your lab group how the numbers in this section represent a different way of expressing the same sequence of numbers at the top of the page. For your page, does this represent an actual savings in terms of total amount of data?
Record your answers on your lab sheet.
At this point, you should assemble your page according to the directions. Try to align your Post-Its with the grid on the back of the page, so that there are exposed pieces with adhesive on the back (see image at right). This is necessary so that the page will be able to adhere to the wall.
When you have completed this exercise, answer these questions on your lab sheet:
The remainder of this lab period should be used for working on your programming project. You should take the time to discuss your project with your lab assistants. If you have questions, this is a good opportunity to ask them.
This lab demonstrated GIF encoding and run-length encoding for compression. In order to demonstrate run-length encoding, each page was shown in a compressed and uncompressed version.
In reality, it is not efficient to use run-length encoding on very small sub-images. The real payoff occurs when dealing with a large image, where hundreds of equally colored pixels may appear in succession. And so, think of this example as an example.