The purpose of this lab was to familiarize myself with the graphics, display, and pixmap packages. We learned how to use these packages to manipulate images we were given.
1. The first step in this project was to write code that would allow me to place a small pixMap at any given point in a much larger pixmap. The code takes in two different pixmaps and a location. It runs through every pixel in a row and takes the pixel of the smaller picture at each location and inserts it into the bigger picture starting with the given location and then working through each row then column.
2. The second step in this project was to create a whole lot of filters that I could run the original image of through. I did this by taking the redFromBlue code from the lab and alternating the effect the function had on each pixel to get the desired effects.
3. The next task in the project was to create a warhol-esque picture. To do this I used the putPixMap function i created for part 1 and ran 4 clones of the same image through different filters and then inserted them into the bigger picture. The resulting image is seen below.
4. The final step in this project was to take the blue screen we had taken our picture in front of and change the color of the blue screen without altering the pixels that were used to make up me. I did this by running through every pixel in the picture and checking to see how blue each pixel was. If each pixel was significantly more blue than anything else the code function took that pixel and changed it to black. The code and resulting picture are seen below:
Extensions. For the extensions I made a 3 x 3 Warhol-esque picture (seen below) and also altered the background, so it could include a picture not just a random color. The code (seen below) acts very similar to the function that changed the color, but instead takes in two pictures in the parameters. It checks to make sure the pictures can fit together then runs through the pixels replacing each pixel from the blue background with a pixel from the new background.
The most important thing I learned from constructing this program was how alter the color of pixels using for loops and if statements. It became the only way to alter the pictures and if I did not learn it I would not have completed the project.