View this PageEdit this PageAttachments to this PageHistory of this PageHomeRecent ChangesSearch the SwikiHelp Guide

Image Collage

Uploaded Image: YellowCollage-small.jpgUploaded Image: CarsCollage-small.jpgUploaded Image: butterrflyCollageHorizontal-small.jpgUploaded Image: collagebuddah-small.jpgUploaded Image: dog-small.jpg

SummaryImage Collage – create a collage of images. Modify a picture at least 3-4 times using different image methods like negate, clear blue, and scale, and copy each resulting picture to a blank picture. Mirror the results from top to bottom (copy pixels from the top to the bottom of the collage).
TopicsMathematical operations, Creating objects, Invoking Methods, Writing methods, Reusing methods, 1D arrays, 2D arrays, Nested for loops
AudienceCS1 or early in CS2
DifficultyIntermediate, Can take 1-4 weeks for a CS student or longer depending on how many image manipulations you want the students to do in the collage. You can make this shorter by giving them code for some of the picture methods.
StrengthsThis assignment is open-ended and allows for students to be creative with their own pictures. Many love creating collages. Often it is the first time they really want to design a solution. It shows students the value of writing reusable methods. It also shows students the value of arrays and iteration.
WeaknessesSome students get frustrated that they can't make the collage look the way they want. Some spend too much time on it. It can be hard to get students to stop working on the collages.
DependenciesYou will need our Picture class and other classes from the bookClasses directory. You can get these at
VariantsYou can create sound collages with only 1d arrays. You can make a photoshop-type application. You can use our Turtle class to drop rotated pictures on the collage.
Exercise SummaryStart with our Picture class which gives you a way to get a 1D array of Pixel objects with the method getPixels. You can use getRed, getGreen, and getBlue methods to get the red, green, and blue color values for the Pixel. You can use setRed, setGreen, and setBlue methods to set the Color values at the Pixel. You can also use getColor and setColor using a normal java.awt.Color object. Create methods to negate, reduce red, clear blue, and grayscale the picture using a simple loop (for-each, while, and/or for). Next, show how to loop while keeping track of the x and y values for the Pixels using a nested for loop. Use the getPixel(x,y) method to get the Pixel object for particular x and y values. Have students write methods to copy one picture to another, copy part of one picture to another, mirror a picture horizontally, mirror a picture vertically, rotate a picture, and scale a picture. Now have them write a method to create an image collage using the methods they have written in the Picture class.
Additional Materials There are powerpoint slides on working with the Picture class which you can get from A sample syllabus is at Our book was published in 2006. See

Link to this Page