Skip to end of metadata
Go to start of metadata

The idea of this project for us to getting more use to pixmaps. One of the major thing is that we use list to store image information to build our collage more efficiently. The list contains information like image name, x-y position, alpha blending value and else. These lists were read using our readImages function and put into a collage.

The first task is to add a new parameter to the collage list, which controls whether to remove "very-green" and "very-blue"background. I create a new "placePixmapNoBkg" function which can collect all green background pixels and copy them to destination image. (Extension) In addition to this, I add a new parameter "c" in placePixmap NoBkg function, which indicates which background is used. So, this function can not only handle green background or blue background.

Then I download some pictures about The song of Ice and Fire online. The original photo looks like this


In file, I create a image of Baratheon.ppm stark.ppm Targaryen.ppm and yushengoriginal.ppm. I also apply symmetry filter, mosaic filter, symmetry filter and black and white filter to these images. In order to apply black and white filter to my photo, I create a special filter "bwwg", which means black white without green. In this filter, I apply black and white only to "no-green" pixels. Then I use placePixmaoNoBkg function to remove background. The resulting photo looks like this.

                           required image 1

My next task is to create a cover photo on Facebook. I apply many new filters to these six photos.  

The first filter is to reverse all color in the photo.

The second filter is to make a mosaic photo (maybe hard to see but this photo is actually blurred)

The third filter is to mix all red, green and blue color value.

The forth is filter is black and white.

The fifth filter is a mirror filter, which replaces all pixels on the left with pixels on the right. I also exchange red and blue color value  in every left side pixels 

The sixth filter is a symmetry filter, which replaces all pixels on the top with pixels on the bottom. I also exchange the red and blue color value in every top side pixels .

                      The required image 2


1.I created a few more new filters that are shown above in my cover photo and my collage photo.

2. For my second extension, I added a new  parameter "c" on placePixmapNoBkg that takes the string value where "b" means background is blue and 'g' means green Background.

3. I also created a diagonal shape for new geometric shape for my collage.

4. I added the mirror option into my collage information list to allow more adjustments. If mirror value equals to True, then Python would apply mirror filter on  image. 

6. For the sixth extension, I figured out how to call the proper function without using if/elif statement. The solution is to use dictionary method. Just like dictionary in our real life,  dictionary method in python works as follow, every keyword correspond to a value. So, in order to run a proper function, I just need to call te keyword in dictionary. (I learned this method by the help of Albert Zhang, sophomore) 

8. For the uber-extension, I put collage information in data.txt, and use a python file called In this file, I first read every line of the txt file by readline() function. Then, I create a new list which includes every line as a term of new list. After this, it comes another problem that the new list changes every elements of original line inside to string. To solve this problem. I set a new loop function, which changes all string type of value to other types of value, such as integer, bool and float. In this way, I create a file that changes txt file to the command line that I need.