##The Short Answer## The effect of residual color is called a mate fringe. For example Photoshop has many tools to delete this most notably <kbd>**Layer → Matting → Defringe...**</kbd>. Other applications call this differently. ![Photoshop Layer -> Matting menu][1] **Image 1**: Some of the fringe removal tools in Adobe Photoshop ##A Technical Description of the Problem## Basically the idea is that a alpha mask can be mathematically described as: C<sub>out</sub> = α * C<sub>image</sub> (1) Where C<sub>out</sub> is the out color and C<sub>image</sub> is the original color α is the alpha channel value. On pixels where 0 < α < 1 you have a pixel where the color is contaminated by both foreground an background color. If you happen to know the background color then you can derive from equation 1 that the contribution of the background is: C<sub>bg</sub> = (1 - α) * C<sub>known</sub> (2) You can now proceed to delete that color from the foreground. You could simply subtract the color form the layer but you'd decontaminate the edge with black (which is what Photoshops remove black does). Removing black matte is simply, C<sub>unmult</sub> = C<sub>black</sub>/α , (3) thus the total color of the pixel is: C<sub>final</sub> = (C<sub>image</sub> - (1 - α) * C<sub>known</sub>)/α **.** (4) But what do you do if you dont know what the color is? Well you could make a guess as to the color by bleeding the non selected background into the subtraction plate C<sub>known</sub>, or bleed the foreground plate to alpha (this is what defringe does). There are fancier methods available. [1]: https://i.sstatic.net/MdkRB.png