refines mask algorithm to work with other alpha pngs