improved RGB to alpha conversion