title: PIL - Image Paste On Another Image With Alpha
body: <p>I'm struggling a touch with pasting one image with a transparent background on another, also with a transparent background, with the right alpha/colour blending.</p>
  
  <p>Here are some example images, red.png and blue.png:</p>
  
  <p><img src="https://i.stack.imgur.com/zNegj.png" alt="red.png"> <img src="https://i.stack.imgur.com/XTzMy.png" alt="blue.png"></p>
  
  <p>I want to paste blue.png on top of red.png, and achieve this effect:</p>
  
  <p><img src="https://i.stack.imgur.com/PeAqa.png" alt="Expected Result"></p>
  
  <p>That image was made by combining the two images in Photoshop, simply as two layers.</p>
  
  <p>The closest I can get using the Python Imaging Library is:</p>
  
  <p><img src="https://i.stack.imgur.com/DHaBy.png" alt="Actual Result"></p>
  
  <p>with this code:</p>
  
  <pre><code>from PIL import Image
  
  blue = Image.open("blue.png")
  red = Image.open("red.png")
  red.paste(blue, (0,0), blue)
  red.save("result.png")
  </code></pre>
  
  <p>Do you see how the alpha and the colour is off where the two circles overlap? In the expected result image, the red and blue blends together in a purplish way, but there's an unwanted alpha halo in the actual result image.</p>
  
  <p>How can I achieve my ideal result in PIL?</p>