def blend_channels_hard_light(bottom_chan, top_chan):
 (dk, lt) = ((top_chan < 0.5), (top_chan >= 0.5))
 output_chan = numpy.empty(bottom_chan.shape, bottom_chan.dtype)
 output_chan[dk] = ((2 * bottom_chan[dk]) * top_chan[dk])
 output_chan[lt] = (1 - ((2 * (1 - bottom_chan[lt])) * (1 - top_chan[lt])))
 return output_chan

def blend_channels_hard_light ( bottom_chan , top_chan ) : ( dk , lt ) = ( ( top_chan < 0.5 ) , ( top_chan >= 0.5 ) ) output_chan = numpy . empty ( bottom_chan . shape , bottom_chan . dtype ) output_chan [ dk ] = ( ( 2 * bottom_chan [ dk ] ) * top_chan [ dk ] ) output_chan [ lt ] = ( 1 - ( ( 2 * ( 1 - bottom_chan [ lt ] ) ) * ( 1 - top_chan [ lt ] ) ) ) return output_chan
return combination of bottom and top channels .