parameters: (self, layers, blends=None)
docstring: layers  : [l1,l2,...ln] : a list of LAYER objects.
                   l1 is on the top, ln is the bottom-most layer.
          blend   : the type of blend to use. Should be n-1.
                   use None for plain alpha blending.
          Note    : (1) it assumes that all the layers are of the SAME SIZE.
          @return : a single LAYER type object representing the merged-down image
docstring_summary: layers  : [l1,l2,...ln] : a list of LAYER objects.
                   l1 is on the top, ln is the bottom-most layer.
          blend   : the type of blend to use. Should be n-1.
                   use None for plain alpha blending.
          Note    : (1) it assumes that all the layers are of the SAME SIZE.
docstring_tokens: layers : [ l1 l2 ... ln ] : a list of LAYER objects . l1 is on the top ln is the bottom - most layer . blend : the type of blend to use . Should be n - 1 . use None for plain alpha blending . Note : ( 1 ) it assumes that all the layers are of the SAME SIZE .
function: def merge_down(self, layers, blends=None):
          """
          layers  : [l1,l2,...ln] : a list of LAYER objects.
                   l1 is on the top, ln is the bottom-most layer.
          blend   : the type of blend to use. Should be n-1.
                   use None for plain alpha blending.
          Note    : (1) it assumes that all the layers are of the SAME SIZE.
          @return : a single LAYER type object representing the merged-down image
          """
          nlayers = len(layers)
          if nlayers > 1:
              [n,m] = layers[0].alpha.shape[:2]
              out_layer = layers[-1]
              for i in range(-2,-nlayers-1,-1):
                  blend=None
                  if blends is not None:
                      blend = blends[i+1]
                      out_layer = self.merge_two(fore=layers[i], back=out_layer,blend_type=blend)
              return out_layer
          else:
              return layers[0]
function_tokens: def merge_down ( self , layers , blends = None ) : nlayers = len ( layers ) if nlayers > 1 : [ n , m ] = layers [ 0 ] . alpha . shape [ : 2 ] out_layer = layers [ - 1 ] for i in range ( - 2 , - nlayers - 1 , - 1 ) : blend = None if blends is not None : blend = blends [ i + 1 ] out_layer = self . merge_two ( fore = layers [ i ] , back = out_layer , blend_type = blend ) return out_layer else : return layers [ 0 ]