Escolar Documentos
Profissional Documentos
Cultura Documentos
def blend(pic1,pic2):
width = getWidth(pic1)
height = getHeight(pic1)
blendPic = makeEmptyPicture(width,height)
for y in xrange(height):
for x in xrange(width):
targetPx = getPixel(blendPic, x, y)
#get pixels
px1 = getPixel(pic1, x , y)
px2 = getPixel(pic2, x , y)
#blur color
setColor(targetPx, blendColor)
#show(blendPic)
return blendPic
def thirdGreen(pic):
p = getPixel(pic,x,y)
color = makeColor(57,100,90)
setColor(p,color)
return(pic)
def thirdBlue(pic):
for y in range(getHeight(pic)/3,2*getHeight(pic)/3):
p = getPixel(pic,x,y)
color = makeColor(0,42,78)
setColor(p,color)
return(pic)
def thirdSand(pic):
for y in range(0,getHeight(pic)/3):
p = getPixel(pic,x,y)
color = makeColor(147,127,85)
setColor(p,color)
return(pic)
def makeBlank():
return makeEmptyPicture(450,450)
def CSUMBy(picture):
canvas = makeBlank()
path = "C:\Python\photoSm.png"
pic1 = makePicture(path)
#pic2 = makePicture("C:\Python\me.jpg")
pic2 = picture
pic3 = blend(pic1,pic2)
#send to green
pic4 = thirdGreen(canvas)
pic5 = thirdBlue(canvas)
pic6 = thirdSand(canvas)
canvas = blend(pic3,pic6)
show(canvas)
writePictureTo(canvas, "C://python//csumby.jpg")
def get_pic():
return makePicture(pickAFile())
#This function creates a Matrix feel to an image that is 1280 X 720 or smaller
def matrixify(picture):
pic1 = picture
pic = lineDwg(pic1)
blended = makeGreen(blended)
show(blended)
#This function creates a green line drawing of the outline of an image and applies it to a black
background
def lineDwg(pic):
#turn B&W
pic = betterBnW(pic)
picture = duplicatePicture(pic)
g = getGreen(px)
#get luminance
#pixel edge
setRed(px, 0)
setGreen(px, g * .8)
setBlue(px, 0)
else:
setColor(px, black)
return picture
def betterBnW(picture):
pic = picture
pixels = getPixels(pic)
for p in pixels:
r = getRed(p)
g = getGreen(p)
b = getBlue(p)
setRed(p, luminace)
setGreen(p, luminace)
setBlue(p, luminace)
return (pic)
pic = picture
pixels = getPixels(pic)
for p in pixels:
g = getGreen(p)
setRed(p, 0)
setGreen(p, g * .8)
setBlue(p, 0)
repaint (pic)
return pic