Computer Science 171
Introduction to Computer Science

Denison
CS171 Homework 7


Homework 7

Picture Posterization

Objective

The objectives of this assignment include the following:

Assignment

The basic output of this assignment is a new picture jpeg that is the posterization of a picture, which reduces the number of colors in a picture.  We will accomplish this by writing one or more java applications that each perform a specific manipulation on a Picture.  For any java program, once it manipulates the picture (and displays it), it should give the user the option of saving it to a file.

Assignment Specification:

For basic completion of the assignment, which will earn 70 out of 100 points, complete the following:

Write a Java application class named Posterize that posterizes a Picture.  It must begin by interactively getting the filename of a picture. It then must create a Picture object from the jpeg file. Finally, it must iterate (using nested loops) over all the pixels in the picture and perform the following, per pixel, manipulation. The color of each pixel should be changed according to the following rules:

Finally, the application should redisplay the image so that the changes appear. sThe program should then query the user to save the file.

For an additional 20 points (for a total of 90 out of 100), write a second Java application called RotateColors that performs the following transformation:

And, as before, redisplay the image and offer to save to a file.

Finally, for an additional 10 points, find some images and then either rotate them or posterize them (or both).  Be creative and find images that have interesting and/or pleasing results.  You may want to write a new version of the Posterize application (that you can name Posterize2) so that you can experiment with different values for the thresholds and values defined above.  After creating a result, save the new posterized or rotated image to a new jpg file.  Be sure and use either good filenames or include a short text file to describe what you have done.  Some of the more interesting images you submit will be posted on the class webpage.

Turn In:

In your Assignment Inbox, turn in each of your applications in a folder named HW7.  Also in that folder, include both before and after jpgs.