CS-171
Program Assignment 3
The objectives of this assignment include the following:
For this assignment you will be creating a collage of images. You should choose your images and composition to reflect the interest that you have so that your collage tells us something about who you are. You will be creating a variety of image manipulation routines that will be needed to create your collage. Below is an example collage that was created by Dr. Kretchmar from the CS department. His particular interests include running marathons and cycling.

The requirements for this assignment can be partitioned broadly into (i) the base requirements (including following the instructions faithfully), (ii) a few required transformations, and (iii) a set of optional transformations. Points are awarded in each category.
(10pts) Make the following additions/changes to your
Picture.java file. Submit this file in a folder named prog3 that you create in your assignment inbox. Also submit copies of your original images (described below) and your final collage project in a file named collage.jpg. Please be sure to use all these filenames exactly as they are spelled here.(10pts) Your collage must have at least five images including one for the background if you wish to create your collage in this way (note my example above only has three images). Search for images that reflect what you do and who you are (they will all have to be jpg files). Compose your images artistically.
(15pts) You must use a scaling routine at least once.
(15pts) You must use a cropping routine at least once.
(15pts) You obviously must use an overlay routine to place the images on the collage.
Although there are not point awards for manipulations you have already been graded for, I would encourage you to use your posterize() and rotateColors() methods to help your artistic endeavor to get interesting effects on the base images used in the collage.
For all of your image manipulation routines, create a new return image that contains the specified changes so that the original image is left unchanged. (This is the design choice we have been making consistently in class, although not used in posterize() and rotateColors()).
Note that the above requirements will earn 65 points on this assignment. You have ample opportunity to earn additional points as described below:
(10pts) Write a rotation routine that spins an image through an angle specified in degrees.
(10 pts) Write a cropping routine that extracts a circle instead of a rectangle.
(10 pts) Generalize your circle cropping routine to extract an ellipse (oval). Note: 10 additional points plus you must also do the circle routine.
(10 pts) Write a second overlay routine that considers ”pure black” as transparent.
(10 pts) Modify your rotate routine to perform a swirl feature.
(15 pts) Do you remember what you look like in those ”fun house” carnival mirrors that distort your image? Write a routine to perform these fun house mirror distortions.
(? pts) Do you have other creative ideas? Ask the instructor and receive additional bonus points for some other image manipulation routine.
Details:
•
Crop: Cropping is the act of removing a portion of an image. You need to specify the upper/left and lower/right coordinates of the rectangular region to extract. Alternatively, as we did in class, we can specify the starting x value and the x length, as well as the starting y value and the y length. Return a new image of the appropriate dimensions that contains only the cropped region. Name your routine cropRectangle. (not crop1)Scale: Provide a scaling factor as a double. Multiply the dimensions by this factor to increase/decrease the height and width of the object. Expand or contract the pixels to create a new copy of the original image. Name your method
scale.•
Overlay: Place one image overtop of another. You should provide the (x,y) coordinates to specify the upper/left corner of the overlay position. If the overlain image extends beyond the boundaries of the underlying image, then ignore that portion of the overlain image and copy as much as is possible. Name your method overlay.•
Transparent Overlay: Same as an overlay except that any pure black areas in the overlaying image ”bleed through” and pick up the underlying image below. Name your method transparentOverlay.•
Circle Crop: Obviously you must create a rectangular image, but extract only a circular portion of the original image and make the outer boundaries of the square pure black (so it works especially well with a transparent overlay). Specify the center (x,y) and radius of the cropping. Name your method cropCircle.•
Ellipse Crop: Remember an ellipse? Two centers and a constant sum of distances? This allows you to do oval croppings. Name your method cropEllipse.•
Rotation: Specify the angle of rotation (in degrees) between 0 and 360 (actually allow any arbitrary angle including negative angles). Rotate the image counter clockwise in this many degrees. Name your method rotate.•
Swirl: You can change the rotation routine above slightly so that the amount of rotation (degrees) changes as a function of the radius. This way some things are rotated more or less as they are farther away from the center points – creates a swirl effect. Name your method swirlCarnival Mirror: Mirrors either distort horizontally or vertically but usually not both. So you can choose one or implement both. Consider the horizontal distortion: the vertical distances are all left unchanged. But the horizontal features are either expanded or compressed from the mid axis running vertically through the image. You can use a sine function to nicely imitate this gradual compression/expansion. Name your method
carnivalMirror.•
Out of bounds?: Many of these routines will create images that exceed the dimensions of the jpg file. If you need to put a pixel out of bounds, then obviously just ignore it (this part of the image will be omitted). See the Lance Armstrong image in my collage above – the corners are missing because after the rotation, they are ”off the bounds” of the image. There will be other instances where there is nothing beneath. Again see the Lance Armstrong image rotation above. There are ”white areas” left over after the image is rotated. Leave these areas as pure white.•
Others: If you create your own image manipulation routines, then be sure to comment them extensively so that we know how to use them and what they are supposed to do.