## Lab 12

This lab assignment will have you write a jython program that will posterize an image with 8 colors.

### 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

### Posterization

Posterization is a technique that reduces the amount of color used in an image. There is an example of this in the examples from lecture 4/06. This example uses if statements for reduce an image to 64 colors. For this lab, we will want to reduce an image to the following 8 colors:

 ` Black r = 0 g = 0 b = 0 ` `Redr = 255g = 0b = 0` `Greenr = 0g = 255b = 0` `Bluer = 0g = 0b = 255` `Yellowr = 255g = 255b = 0` `Magentar = 255g = 0b = 255` `Cyanr = 0g = 255b = 255` `Whiter = 255g = 255b = 255`

Note that the red, green and blue values for each image is either 0 or 255. So when doing this, you will need to check the intensity level for each of the three colors at every pixel. If the intensity level for a color is 127 or less, set the intensity of that color to 0. If the intensity level for a color is 128 or more, set the intensity of that color to 255.

### Lab Assignment 12

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

Create a file using JES that will:

1. Contain a comment indicating
• your Name,
• 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 an eight color posterized image.
• display the posterized 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.