title: Produce a composed image with different sized layers with transparency
body: <p>I'm very new to Python and am exploring it's use to allow users to build custom images.  The idea is that the client would select a few options and the image would be created on the server then downloaded (or used for other things on the server side).</p>
  
  <p>The image is composed of many images, most of which are small icon type of images that are irregular shapes and have transparency.  All layers are <code>.png</code> files.</p>
  
  <p>I've tried using Pillow but it seems the image needs to be the same size as the overall image to properly use the transparency of the top layers.</p>
  
  <p>Here's what I've tried so far:</p>
  
  <pre><code>from PIL import Image
  
  background = Image.open("Background.png")
  foreground = Image.open("Trim.png")
  fire = Image.open("Type_Fire_Large.png")
  
  background = Image.alpha_composite(background, foreground)
  background.paste(fire, (150, 150))
  background.show()
  </code></pre>
  
  <p>The image looks like this:</p>
  
  <p><a href="https://i.stack.imgur.com/2mAAd.png" rel="noreferrer"><img src="https://i.stack.imgur.com/2mAAd.png" alt="Layered image with black on overlay"></a></p>
  
  <p><code>Background.png</code> is the shaded "noise" and <code>Trim.png</code> is the grey diagonal lines.  The best part: <code>Trim.png</code> has the center transparent and is able to show <code>Background.png</code> in the middle.  But it's also the same size as the image.</p>
  
  <p>The problem is <code>Fire</code>; notice how theres that black border (and odd fuchsia dot).  The documentation states that the overlay image needs to be the same size.  But it seems like a common scenario where someone would want to place a smaller icon with transparency on top of another image and compose them into one image.</p>
  
  <p>I'm not attached to any particular library, I'm wide open to ideas and alternatives.  The only thing I'm trying to do is keep it simple, so creating an entire game engine or the like to produce an image would probably be too much.</p>