def
decreaseTopHalfRed(pic): show(pic) for x in range(1, getWidth(pic)): for y in range (1, getHeight(pic)/2): p = getPixel(pic,x,y) value = getRed(p) setRed(p, value * .5) repaint(pic) |
#---------------------------------------------# # Chromakey Function with ability to select # Where you want subjet to go # Mr. Michaud # www.nebomusic.net def chromakey(chroma, bg, bgx, bgy): bgtargetX = bgx for chromaX in range(1, getWidth(chroma)): bgtargetY = bgy for chromaY in range(1, getHeight(chroma)): px = getPixel(chroma, chromaX, chromaY) tx = getPixel(bg, bgtargetX, bgtargetY) if getRed(px) + getBlue(px) < getGreen(px): setColor(tx, getColor(tx)) else: setColor(tx, getColor(px)) bgtargetY = bgtargetY + 1 bgtargetX = bgtargetX + 1 return bg #---------------------------------------------#
#---------------------------------------------------# # Warhol Effect # Mr. Michaud # www.nebomusic.net # Function to Scale down picure by 1/2 def scalePicDown(pic): canvas = makeEmptyPicture(getWidth(pic)/2, getHeight(pic)/2) picX = 1 for targetX in range(1, getWidth(canvas)): picY = 1 for targetY in range(1, getHeight(canvas)): color = getColor(getPixel(pic, picX, picY)) setColor(getPixel(canvas, targetX, targetY), color) picY = picY + 2 picX = picX + 2 return canvas # Picture Chooser def pickAndMakePicture(): Pic1 = pickAFile() Pic1 = makePicture(Pic1) return Pic1 # Warhol Effect def warholEffect(pic): dest = scalePicDown(pic) dest = scalePicDown(dest) canvas = makeEmptyPicture(getWidth(dest)*8, getHeight(dest)*8) # Start copying in pictures for y in range(8): for x in range(8): canvas = copy(dest, canvas, (getWidth(dest)*x + 1), (getHeight(dest)*y)+1) return canvas # General Copy Function def copy(source, target, targX, targY): targetX = targX for sourceX in range(1, getWidth(source)): targetY = targY for sourceY in range(1, getHeight(source)): px = getPixel(source, sourceX, sourceY) tx = getPixel(target, targetX, targetY) setColor(tx, getColor(px)) targetY = targetY + 1 targetX = targetX + 1 return target #---------------------------------------------------#