So recently I came across a little issue while writing a Python library, involving the rotation of images with PIL.
I was trying to rotate an image I was loading by calling Image#rotate(angle, expand=True)
on an image would create weird black bars around the image:
image = Image.open('image.png')
image = image.rotate(angle, expand=True)
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.
In terms of answers, you find a lot of suggestions to set the fillcolor argument on the rotate method.
image.rotate(angle, expand=True, fillcolor=(0, 0, 0, 0))
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.