I am running a bot that periodically downloads an image from a website and uploads it to Twitter. Sometimes, however, the images get grey bars on the bottom, resulting in uploaded images that look like this or this.
This is the code that downloads the image as 'localImage.jpg' and overwrites the previous image:
image_stream = requests.get('linkToImage', stream=True)
local_image = open('localImage.jpg', 'wb')
image_stream.decode_content = True
shutil.copyfileobj(image_stream.raw, local_image)
The entire repository is here.
My question is what is it that could be causing the image to upload with the grey boxes on the bottom?