Beruflich Dokumente
Kultur Dokumente
def BnW():
This program will take filename = pickAFile()
any colored, or even non pic =
colored, picture and turn makePicture(filename)
it into a black and white pixels = getPixels(pic)
picture by scaling all of for p in pixels:
the colors to a like pallet. r = getRed(p)
g = getGreen(p)
b = getBlue(p)
scale = ((r + g + b)/3)
setRed(p, scale)
setBlue(p, scale)
setGreen(p, scale)
repaint(pic)
Bottom-to-Top Mirror
repaint(picture)
Collage
This lab I
incorporated a little
bit of each of the
previous labs into it.
However, for some
reason whenever I
would save this file it
would change the
overall color to a
redder color.
sourcePic = makePicture(source)
targetPic = makePicture(target)
sourceWidth = getWidth(sourcePic)
sourceHeight = getHeight(sourcePic)
targetWidth = getWidth(targetPic)
targetHeight = getHeight(targetPic)
def setBorder(greenScreen,
background):
gscreen=makePicture(greenScree
This is actually a part of our
n)
St. Patricks day card but it
uses the green screen
background=makePicture(backgro
effect to add the border to
und)
the picture. Since the
pg=getPixels(gscreen)
overall picture is rather
pb=getPixels(background)
green already we ended up
gsc=makeColor(255,0,255)
making it more of a fusha
for p in pg:
screen to avoid unwanted
color = getColor(p)
alterations.
dist=distance(color,gsc)
if dist < 170:
np=getPixelAt(background,getX(p)
,getY(p))
setColor(p,getColor(np))
show(gscreen)
This is my groups St. Patricks day greeting card. I do not have
the file for the leprechaun that we used so this one is a little out
of scale, but it brings together several elements in a nice
greeting card.