CSC151 2007S, Class 40: Color Palettes Admin: * Cookies * Assignment 14 (A Procedure is Worth A Thousand Pictures) is now ready. * The Project Description is now ready. * Reading for Thursday: Vectors. * Reminder: EC for Thursday's Thursday Extra Overview: * Saving space with palettes. * Choosing palette colors. * Using different palettes. Writing images to a file * For each position in sequence, write the position and color * Can also do so without the positions, as long as the order is known. * If we're going to write all the colors, we should do so as efficiently as possible. Past techniques: * Write the number that represents the color: * Hard to read * Lots of characters (up to 10 per color) * Represent the color as RGB values * Easier to read * Lots of characters (up to 12 per color) * Represent the color as RGB values, with each RGB value represented by a single character * Fewer characters (exactly 3 per color) * Essential unreadble by humans (easy for computers) Today: Can we do better? * Still using the model that we're writing each color separately. * For an 8x8 image, we need only write 64 values (vs. 192 for the previous model) * By using a limited number of colors (chosen in some way), we can represent images more efficiently. * Technique: Palettes * What if there are more colors in the image than in the palette? * Scale the values * APPROXIMATE THE IMAGE