Task 5 was essentially the same, except this time, user input was required. The only difference was the images and their locations and the first item in the collage image list having the input filename be assigned to it. The program would require the name of a .ppm-format image, retrieved from the sys.argv list. The resulting image is shown below.
I also did extensions 2 and 5. For extension 2, I needed to make some kind of way for the program to tell if the background color was blue or green so it could remove it using the placePixmapNoBkg function. This required, first, a new index to be added to the lists, and also, the buildCollage function to be altered; if no background was requested and the green background variable was given (set if the swapRedBlue filter was not applied), then green would be taken out, and the same was done for blue, except it would mean that the red-blue switch filter was applied. In the placePixmapNoBkg function, I also simply swapped around the values of red and blue to change which color was to be specified as the background.
For extension 5, I made it so however many images given in the command line would be assembled to make a collage according to a preset list with the coordinates, filters, and everything except for the image file. The code is displayed below; I mostly used if statements to achieve my goal.
Overall, this project taught me a lot about making and manipulating lists and tracing user input in the command line. I also learned how to place images within other images.
Worked with: Prof. Maxwell