Programming Project 2

In case you're thinking about plagiarizing, I've included the code below in order to facilitate the process. Enjoy!
#This first section will set up the functions to be used in the collage.
#makeSunset will be used in Picture 2 (below)
def makeSunset(picture):
for p in getPixels(picture):
value=getBlue(p)
setBlue(p,value*0.7)
value=getGreen(p)
setGreen(p,value*0.7)
return(picture)
#negative will be used in Picture 3 (below)
def negative(picture):
for px in getPixels(picture):
red=getRed(px)
green=getGreen(px)
blue=getBlue(px)
negColor=makeColor(255-red, 255-green, 255-blue)
setColor(px, negColor)
return(negative)
#grayScale will be used in Picture 4
def grayScale(picture):
for p in getPixels(picture):
intensity=(getRed(p)+getGreen(p)+getBlue(p))/3
setColor(p,makeColor(intensity, intensity, intensity))
return(picture)
#sepiaTint will be used in picture 5
def sepiaTint(picture):
grayScale(picture)
for p in getPixels(picture):
red=getRed(p)
blue=getBlue(p)
#tinting shadows
if (red<63):
red=red*1.1
blue=blue*0.9
#tinting midtones
if (red>62 and red<192):
red=red*1.15
blue=blue*0.85
#tinting highlights
if (red>191):
red=red*1.08
if (red>255):
red=255
blue=blue*0.93
#setting the new color values
setBlue(p, blue)
setRed(p,red)
return(picture)
#The following section will actually set up the collage.
def collage():
picture=makePicture(pickAFile())
print picture
canvas=makeEmptyPicture(800,800,black)
print canvas
#First picture, normal, at front and center!
targetX= (getWidth(canvas)-getWidth(picture))/2
for sourceX in range(1,getWidth(picture)):
targetY= (getHeight(canvas)-getHeight(picture))/2
for sourceY in range(1, getHeight(picture)):
px=getPixel(picture,sourceX,sourceY)
cx=getPixel(canvas, targetX, targetY)
setColor(cx,getColor(px))
targetY=targetY +1
targetX=targetX+1
#above f(x) worked, but I might need to look at resizing...
#Second Picture, sunset feature utilized, upper-left corner of canvas
makeSunset(picture)
targetX=1
for sourceX in range(1,getWidth(picture)):
targetY=1
for sourceY in range(1,getHeight(picture)):
px=getPixel(picture,sourceX,sourceY)
cx=getPixel(canvas,targetX,targetY)
setColor(cx,getColor(px))
targetY=targetY+1
targetX=targetX+1
#Third Picture, negative f(x), bottom-left corner of canvas
negative(picture)
targetX=1
for sourceX in range(1,getWidth(picture)):
targetY=getHeight(canvas)-getHeight(picture)
for sourceY in range(1,getHeight(picture)):
px=getPixel(picture,sourceX,sourceY)
cx=getPixel(canvas,targetX,targetY)
setColor(cx,getColor(px))
targetY=targetY+1
targetX=targetX+1
#Fourth Picture, grayScaling it, bottom-right corner.
grayScale(picture)
targetX=getWidth(canvas)-getWidth(picture)
for sourceX in range(1,getWidth(picture)):
targetY=getHeight(canvas)-getHeight(picture)
for sourceY in range(1,getHeight(picture)):
px=getPixel(picture, sourceX,sourceY)
cx=getPixel(canvas,targetX,targetY)
setColor(cx,getColor(px))
targetY=targetY+1
targetX=targetX+1
#Fifth Picture, going Sepia, top-right corner of canvas.
sepiaTint(picture)
targetX=getWidth(canvas)-getWidth(picture)
for sourceX in range(1,getWidth(picture)):
targetY=1
for sourceY in range(1,getHeight(picture)):
px=getPixel(picture, sourceX,sourceY)
cx=getPixel(canvas,targetX,targetY)
setColor(cx,getColor(px))
targetY=targetY+1
targetX=targetX+1
show(canvas)
return(canvas)