The key purpose of this project was to be able to manipulate (r,g,b) values in pixmaps to create filters that change the pixmap. We also learned how to place a pixmap into another.
First I wrote a placePixmap function that used two for loops, one nested in the other, to one by one move through each pixel in the pixmap you were placing to find the (r,g,b) values. Then I changed the (r,g,b) values of the pixel in the other pixmap at the spot x,y plus the row and column indices, into the (r,g,b) values of the pixel in the first pixmap.
I then, after writing the swapRedBlue function, I wrote three more functions in filter.py that would change the (r,g,b) values in each pixel according to my sets of rules I made for each filter.
Next, I created a new python program, warhol.py, that would take in an image filename from the command line, create 4 copies of it, put each copy through a different filter from filter.py, and then place these four newly changed images into a new bigger pixmap that fit each in a square. The resulting image is this:
Finally, the last step was to write a new function, I called mine changeBackground(), that would turn the very green background to a different color. I used the same for loop set up as the other filters, but before changing the pixel's (r,g,b) value, an if statement would check to see if the pixel was very green. If it was, I changed the (r,g,b) values to (0,0,g). This came out as follows:
From this project, I learned how to move across a pixmap pixel by pixel, and mess with the (r,g,b) value found at each pixel. I also learned how to place pixmaps into other pixmaps. I also worked alone on this.