This is a Javascript to create  mask using the channesl in Photoshop