# Pages CS 151 Computational Thinking Fall 2012 Project 4 The Warhol Project

You are viewing an old version of this page. View the current version.

Version 5

The purpose of this project was to create functions that would manipulate pixels of an image to create interesting effects on that image. Then, using these different functions I created a Warhol collage of the same photo with different effects on that image. The last major task of this assignment was to create a python program that would take the blue-screen image and turn the blue pixels into a different color.

I played around with the r,g,b values of each pixel to create a new and interesting images. For instance, I had a function that would make the image look like a negative print by subtracting all r, g, b values from 255. 255 is used because all r, g, b values are on a scale of 0 to 255.

I created a few other unique functions using similar manipulations of the r, g, b values.

Then, I created a Warhol collage by cloning my pmap (my Pixmap that I assigned to be the image of myself). I cloned this image 4 times and then called different functions to executeon the four cloned maps. For example, this is how I cloned the pmap the first time and then called the MakeNegative function on it.

I, then, created a new Pixmap that was doubly wide and double the height of the original 'pmap' because I want all four cloned pmaps to fit in this new Pixmap. Each cloned map will fit into a quadrant of the new Pixmap.

Completing the last task of this project was the most difficult for me to figure out how to use the nested for loops and if statement within the noBlue function.

This snippet of code shows the if statement I used to assign b to a value of 'very blue' when it was greater than the green channel and 1.5 times the red channel. If the pixel had a blue channel with these stipulations, then the blue channel was switched to a value of 0. The resulting image showed no blue pixels.

EXTENSIONS:

What I learned:

I learned how a Pixmap can be used and how fun it is to manipulate images using Python. I didn't realize that r,g,b values were on a scale of 0-255, so playing around with the values to make a negative image was very interesting to learn.

Labels
• No labels