The targeted task of this project was to design a program which could take in multiple images as inputs manipulate their pixel mappings and then place them in any given array. This was achieved through an overarching set of functions which filtered then placed an image based on a given set of inputs.
This first image is a collection of five images. Four of the images have been set to overlay the one at its four corners. The four images, images of people, are images which have been filtered as to remove the blue screen in the original images. As was alluded to in the introduction, this process was achieved by refining the mechanisms used in the last project. The process was broken down into three main functions, a function which converts the image into a pixel map, a function which identifies the size of the given image, and a function which builds a collage with a given set of inputs. The final function, buildCollage(), achieved this task by using a for loop which references lists within a list and manipulates the whole image with each consecutive image. In this light, each image was represented by each distinct list, which contained all necessary information to both manipulate and place the image. For example by using a four loop each element of each list could be assigned to an aspect of the overall function:
"for item in clist:
filename = item
x0 = item
y0 = item
operator = item
alpha = item
noBlue = item
src = item[-1]"
here you can see that the items in the list item are each assigned to their own variable which effects the overall function.
The image and file can be found in my private folder
The second image and the final step of the project was to create a function which transposed three images in a pyramid-like format. As you can see I used three generic images and ran them through radical filters which made their overall appearance almost illegible (I will pretend that this was the goal). For this collage, each image was run through a random filter and run with a random alpha value. These features were achieved via the random module:
"filters = ["radioactive", "idk","idk2","idk3"]
collagelist = 
for i in range(1,4):
collagelist.append([argv[i],0,0,random.choice(filters),0.5 +0.5*random.random(),False, None])"
As you can see, by assigning all available filters to a list the random.choice feature could be used to pick a filter at random.
Finally pacing the given images would have to depend on the sizes of the images in order to place them appropriately in the desired format. This was achieved by defining several variables to the different sizes of the given images and then manipulating the placement of each image based on these distances:
"bottomwidth = collagelist[-1].getWidth() + collagelist[-1].getWidth()
topheight = collagelist[-1].getHeight()
if bottomwidth > topwidth:
collagelist = (bottomwidth-topwidth)/2
collagelist = topheight
collagelist = topheight
collagelist = bottomwidth/2"
Please note that the above collage format will place the top image evenly above the two bottom images and place it at the height of the two bottom images.
The image and file can be found in my private folder.
Though I did not have ample time to take on too many of the extensions, I did attempt to design a unique filter. The idea of the filter was that it would present one image via a collection of smaller images. Like the example below a given image could be made up of smaller images each with similar shades to the section of the larger image that the smaller image is intended to represent.
Please Note that this is an Example of concept:
The filter would accomplish this by pulling the color of a pixel at a given point and then covering that section with an image made up largely of blue screen. By using the bluebegone function, the blue screen for the added image could then be filled with the color of it's regions original color. Though this could not be applied effectively to images with little color contrast I thought it would prove to be an interesting filter. Ultimately this filter proved rather ineffective in overall use because it used four consecutive for loops within each other, each containing rather large ranges for most images. This meant that for any image of real size the function would take too long to execute.
The code is listed below for anyone interested:
image = graphics.Pixmap(argv)
image2 = graphics.Pixmap(argv)
for row in range(0,image.getHeight(),20):
for col in range(0,image.getWidth(),20):
(r,g,b) = image.getPixel(col,row)
for row2 in range(image2.getHeight()):
for col2 in range(image2.getWidth()):
(r2,g2,b2) = image2.getPixel(col2,row2)
if b2 > (2*r2):
filter.putPixmap2(image2, image, 0+row, 0+col, None)
It must be stated that because of the length that it takes for this function to execute and the mysterious behavior of the function. I have no proof of concept.
The code can be found under roger.py in my private folder
Though this project like the last used mostly functions described and discovered in previous projects, the most demanding and novel aspect of the code was the use and manipulation of complex lists. The use of lists allowed me to simplify organize information which would be impossible to accomplish otherwise. Though useful, the lists also demanded the most concentration and were probably the element of this project which most challenged me.