Wednesday, January 18, 2012

YAY!

filter to place a foreground into a background...its made for a gray screen rather than a green screen.

def placeFore( big, lil, x, y  ):
  cWid = getWidth( big )
  xLim = x +  getWidth(lil)
  if xLim > cWid:
    xLim = cWid
  cHt = getHeight( big )
  yLim = y + getHeight( lil )
  if yLim > cHt:
    yLim = cHt
  xlil = 0
  for j in range( x,xLim ):
    ylil = 0
    for k in range( y, yLim ):
      p = getPixel(lil, xlil, ylil )
      if getRed(p)== getBlue(p)== getGreen(p) and 100<getRed(p)<255:
        pass
      else:
        newColor = getColor(p)
        setColor( getPixel( big, j,k), newColor )
      ylil = ylil + 1
    xlil = xlil + 1

2 comments:

  1. Thank you so much! I talked to Oldham and he basically said what you told me. I hope the others look at this code and the hard work you have put into it! Good luck!

    ReplyDelete
  2. Thanks for posting this, it was really useful for my centerpiece!

    ReplyDelete