def apply_adjustments(rgba, adjustments):
 if (not adjustments):
  return rgba
 for adjustment in adjustments:
  (name, args) = (adjustment[0], adjustment[1:])
  if (name == 'threshold'):
   rgba = apply_threshold_adjustment(rgba, *args)
  elif (name == 'curves'):
   rgba = apply_curves_adjustment(rgba, *args)
  elif (name == 'curves2'):
   rgba = apply_curves2_adjustment(rgba, *args)
  else:
   raise KnownUnknown(('Unrecognized composite adjustment: "%s" with args %s' % (name, repr(args))))
 return rgba

def apply_adjustments ( rgba , adjustments ) : if ( not adjustments ) : return rgba for adjustment in adjustments : ( name , args ) = ( adjustment [ 0 ] , adjustment [ 1 : ] ) if ( name == 'threshold' ) : rgba = apply_threshold_adjustment ( rgba , * args ) elif ( name == 'curves' ) : rgba = apply_curves_adjustment ( rgba , * args ) elif ( name == 'curves2' ) : rgba = apply_curves2_adjustment ( rgba , * args ) else : raise KnownUnknown ( ( 'Unrecognized composite adjustment: "%s" with args %s' % ( name , repr ( args ) ) ) ) return rgba
apply image adjustments one by one and return a modified image .