Due: Tuesday, March 7, 2017, 11:59 pm
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.
Here is the reference guide to the Zelle graphics package.
For this assignment you're going to create a couple of new functions. The buildCollage function should go in your collage.py file and will process the collage list information and build the output image. The placePixmapNoBkg function should go in your filter.py file and will be identical to placePixmap, except that it will not transfer blue/green screen pixels into the destination image.
In your collage.py file, create a function buildCollage, as given below. Each comment is a line of python code in the final function. The indentation of the comments should match the code.
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 pictureParams in clist
# assign to filename the filename information in pictureParams
# assign to x0 the X offset information in pictureParams
# assign to y0 the Y offset information in pictureParams
# assign to operator the filter parameter from pictureParams
# assign to alpha the alpha blend parameter from pictureParams
# assign to noBkg the background removal parameter from pictureParams
# assign to src the Pixmap element from pictureParams
# use a set of if/elif statements to apply the correct
# operator to the image (this is several lines of code)
# call placePixmap to put src into dst at location x0, y0 with blend alpha
# return dst
You can use the function testbuildcollage.py to test your buildCollage function. Read through the test function before you use it. 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.
As always, remember to remove the comments we supply after you have written your code, and don't forget to add a docstring.
__name__.
if __name__ == "__main__":
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 use at least four different source images.
The collage should include at least five different sub-images. Some of these can be copies of one of the source images with different effects. The collage should use at least 3 effects, at least one alpha blend, and at least one blue-screen or green-screen image where the background pixels are not copied into the collage.
Required image 1 is your first collage.
The collage should be about three times as wide as it is tall and have at least three sub-images. You can control the height and width of the collage by appropriate selection and placement of your images, or you can fix the relative height and width and change placePixmap to safely handle images that go outside the image boundaries. You can choose random effects for the three images or pick specific effects. The collage should use at least two effects.
Required image 2 is your cover photo collage.
Turn in your code by putting it into your private hand-in directory on the Courses server. All files should be organized in a folder titled "Project 5" and you should include only those files necessary to run the program. We will grade all files turned in, so please do not turn in old, non-working, versions of files.
Make a new wiki page for your
assignment. Put the label cs151s17project5 in the label field
on the bottom of the page. But give the page a meaningful title (e.g.
Ying's Project 5).
In general, your intended audience for your write-up is your peers not in the class. Your goal should be to be able to use it to explain to friends what you accomplished in this project and to give them a sense of how you did it. Follow the outline below.
cs151s17project5© 2017 Ying Li. Page last modified: .