CS-171
The objectives of this assignment include the following:
The basic output of this assignment is to posterize 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.
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 or non-interactively getting the filename of a picture. It then must create a Picture object from the jpeg file. Finally, it must iterate (using nested for 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. (Hint: see the book for how to redisplay an image. It is not the show method.) The 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. We will also vote (and award extra credit) based on the best submissions.
If you want to see what last year's class did on this assignment, go to the following URL: