Homework 4: Blending Colors

Due: 11 a.m., Tuesday, September 11
No extensions!

Summary: In this assignment, you will use the color manipulation operations you learned in the lab on RGB colors to blend colors together.

Purposes: To get you comfortable working with the basic color operations in the GIMP. To help you think about colors.

Expected Time: About one hour.

Collaboration: I would prefer that you work in groups of size three. However, you may work alone, in a group of size two, or a group of size four. You may discuss this assignment and possible solutions with anyone you wish. If you discuss this assignment with people other than group members, make sure to include a citation (e.g., I consulted this person, who helped me do this).

Submitting: Email me your answer. More details below. Each group need submit only one answer.

Warning: So that this exercise is a learning assignment for everyone, I may spend class time publicly critiquing your work.

Contents:


Background

A common effect in digital graphics is a color blend, in which colors range more or less smoothly from one color to another. For example, this image shows a blend from blue to red: Blend from pure blue to pure red

You now know how to manipulate the red, green, and blue components of colors used in digital images. In particular, you can extract the red, green, and blue components of a color using rgb.red, rgb.green, and rgb.blue, and you can construct an RGB color using rgb.new. Along with basic mathematical and image operations, this is enough to let you construct blends similar to the above.

Assignment

(a) For your first blend, create definitions to assign the names color1 and color2 to two of your favorite colors from the lab on raster graphics. Then write Scheme instructions to create an image 11 pixels wide and 1 pixel high that is a blend from color1 to color2. Do not compute the RGB values of the intermediate colors by hand; write Scheme instructions so that DrFu can do it for you.

What algorithm should you use to blend the colors? That's up to you. As a hint, you might want the middle pixel to be the average of color1 and color2.

(b) For your second blend, assign the names color1 and color2 to one of your favorite colors and a pseudo-complement of that color. Use the Scheme instructions you wrote in (a) to generate a blend from color1 to color2. What do you notice about the colors in the middle? Why does this happen?

(c) (For extra credit) Write Scheme instructions to create a 5 x 5 image with a different color in each of the four corners. Then, fill in the edges with a blend of the two corner colors. Finally, fill in the middle with a blend as well. How should you blend the colors in the middle? Again, it's up to you.

Important Evaluation Criteria

I will primarily look at the algorithm you use to blend the colors.

Submitting Your Homework

Please submit this work via email. The email should be titled CSC151 HW4 and should contain your answers to all parts of this assignment. Please send your Scheme work as the body of an email message. Attach the images you created in steps (a), (b), and possibly (c).


Janet Davis (davisjan@cs.grinnell.edu)

Created September 6, 2007 
Last revised September 7, 2007