def swapbg(person, bg, newbg):

  someValue = 10

  for x in range(1, getWidth(person)):
    for y in range(1, getHeight(person)):

      personPixel = getPixel(person, x, y)
      bgpx = getPixel(bg, x, y)
      personColor= getColor(personPixel)
      bgColor = getColor(bgpx)

      if (distance(personColor, bgColor) < someValue):
        bgcolor = getColor(getPixel(newbg, x, y))
        setColor(getPixel(person, x, y), bgcolor)

