Project 5: Blended Collages
The purpose of this project is to make a program that processes a list defining a collage and builds the resulting image. The collage list information can specify if the program should apply an effect and/or an alpha blend to each image.
For this assignment you're going to add a couple of functions to the collage.py file you started in lab. One, buildCollage, will process the collage list information and build the output image. The other, putPixmapNoBlue, will be identical to putPixmap, except that it will not transfer blue screen pixels into the destination image.
In your collage.py file, create a function buildCollage, as given below.
def buildCollage( clist ): # assign to (cols, rows) the result of calling getImageSize with clist # assign to dst the result of calling graphics.Pixmap with cols and rows # for each item in clist # assign to filename the first element in item # assign to x0 the second element in item # assign to y0 the third element in item # assign to operator the fourth element in item # assign to alpha the fifth element in item # assign to src the last element in item (index -1) # use a set of if/elif statements to apply the correct # operator to the image (this is several lines of code) # call putPixmap to put src into dst at location x0, y0 with blend alpha # return dst
You can use testbuildcollage.py to test your buildCollage function. The test function assumes that your build collage knows what to do with the operator strings 'rbswap' and 'original', as we went over in lab.
- In your collage.py file, create a function putPixmapNoBlue that has the same arguments and does the same thing as putPixmap, but does not copy the src pixel into the destination image if the src pixel is part of the blue screen.
- Edit your buildCollage program so that it uses the sixth element in the collage information list to determine whether to call putPixmap or putPixmapNoBlue as the last step in the main for loop.
Make a new python file collmain1.py that contains a single main
The main function should create a collage information list, call readImages, call buildCollage, then write the image to a file. You can use the testbuildcollage.py file as an example. Your collage should us at least 4 pictures, multiple effects, at least one alpha blend, and include one blue screen image where the blue screen area is not copied into the collage. This is required image 1.
- Make a new python file, tricollage.py, that takes in three filenames from the command line. It should build a collage with the three images in a triangular configuration and write it out to a file. You can choose random effects for the three images, or pick specific effects. The collage should use at least two effects and one alpha blend. This is required image 2.
- Create some new image effects you didn't implement in the last lab.
- Make some additional programs that generate collages with specific geometric arrangements, but that take their list of pictures from the command line.
- Add additional options to the collage information list, like whether to mirror the image or not, in addition to the other options.
- Create a collage dynamically based on how many images are given on the command line.
- Figure out how to call the proper effect function on each image without using an if/elif control structure. (Ok, this is kind of esoteric, but it's a cool feature of python.)
Make a new wiki page for your assignment. Put the label cs151s10proj5 on the page. Each of you needs to make your own writeup.
In addition to making the wiki page writeup, put the python files you wrote on the Academics server in your handin directory.
In general, your writeup should follow the outline below.
- A brief summary of the task, in your own words. This should be no more than a few sentences. Give the reader context and identify the key purpose of the assignment.
- A description of your solution to the tasks, including any images you created. This should be a description of the form and functionality of your final code. You may want to incorporate code snippets in your description to point out relevant features. Note any unique computational solutions you developed.
- A description of any extensions you undertook, including images demonstrating those extensions. If you added any modules, functions, or other design components, note their structure and the algorithms you used.
- A brief description (1-3 sentences) of what you learned.
- Don't forget to label your writeup so that it appears in the listing on the main wiki page for the course. For this lab, use cs151s10proj5