## Lab 11

This lab assignment will have you write a jython program that will make a black and white version of a color image.

### Reminder

The program Jython Environment for Students (or JES) is the development environment that we will use for this lab.

In the ACCC Labs that have JES, it can be found by:

1. Clicking on Start
2. Then click on All Programs
3. Then click on Class Applications
4. Then click on Engineering
5. Finally click on Jython Environment for Students

### Images Using a GrayScale

A black and white picture uses various shades of gray. These shades of grey all have the same amount of red, green and blue color. The higher the color value, the lighter the shade of gray is. The lower the color value, the darker the shade of gray is. For example, look at the following squares for various shades of gray. The amount of red, green and blue for the color is displayed as text in each square. Note that the amount of red, green and blue is the same in each square. Also note that the larger the amount of color, the lighter the color of gray.

 ` r = 0 g = 0 b = 0 ` `r = 63 g = 63 b = 63 ` `r = 127g = 127b = 127` `r = 191g = 191b = 191` `r = 255g = 255b = 255`

### Determining the amount of gray

One method to determine which grayscale color to use for a pixel when creating a black and white picture from a color picture is to average the amount of red, green and blue color the corresponding pixel in the colored picture. This method works fairly well and is fairly easy to understand and use. This way using the intensity of each color to determine the grayscale value.

Another method is to take a weighted average of the amount of red, green and blue color instead of an evenly-weighted average. A weighted average would give more weight to certain values and less weight to other values. A weighted average will be used when determining the grade for this course. Exams have a higher weight (i.e. more impact on the final grade), while lab assignments have a lower weight (i.e. less impact on the final grade). For determining the amount of color for the graycolor color, the original amount of green is often given a higher weight while the original amount of blue is given a lesser weight. The percent of each color that should be used according to some research done on luminanse is:
 Red Green Blue :   :   : 29.9% 58.7% 11.4%

### Lab Assignment 11

Due: Friday 4/7/2006 by 12:00 noon

Create a file using JES that will:

1. Contain a comment indicating
• Net-ID,
• Course Name,
• Assignment Name and
• a short description of the assignment

2. Contain a JES function that will
• allow the user to pick an image using pickAFile().
• change the selected image to a black and white image. To determine the grayscale color, we will use a third method. This method uses a weighted average but puts less emphasis on the color green that was done in the weighted average discussed above. The percent to be used for each color is:  Red Green Blue :   :   : 29.9% 48.7% 21.4%
• display the black and white image.
• allow the user to save the image where the name of the file is determined by using pickAFile().
This function may call other functions that are built-in to JES or that you have written.

On the ACCC lab computers, the H: drive is a permanent storage area for you. Saving files to this drive on one computer can be accessed from another computer (even another computer in a different lab). It is suggested that you save your python programs to the H: drive.

You are to submit the file containing the JES function that you created to make the black and white image by emailing it to the CS 100 course account at i100@cs.uic.edu.