title: Remove Black Bars/Excess from Image rotated with PIL
body: <p>So recently I came across a little issue while writing a Python library, involving the rotation of images with PIL.</p>
  <p>I was trying to rotate an image I was loading by calling <code>Image#rotate(angle, expand=True)</code> on an image would create weird black bars around the image:</p>
  <pre class="lang-py prettyprint-override"><code>image = Image.open('image.png')
  image = image.rotate(angle, expand=True)
  </code></pre>
  <p><a href="https://i.stack.imgur.com/hcuKN.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/hcuKN.png" alt="Rotated Image with Black Bars/Excess" /></a></p>
  <p>This is obviously not ideal for us as we want the image rotated without any sort of additions or excess. This is obviously not what we wanted.</p>
  <p>In terms of answers, you find a lot of suggestions to set the fillcolor argument on the rotate method.</p>
  <pre class="lang-py prettyprint-override"><code>image.rotate(angle, expand=True, fillcolor=(0, 0, 0, 0))
  </code></pre>
  <p>It's clear that this looks like it could be a solution but the fillcolor cannot be RGBA, so we cannot pass in an alpha value.</p>