DocNow / diffengine

track changes to the news, where news is anything with an RSS feed
MIT License
177 stars 30 forks source link

unable to tweet image #18

Open edsu opened 7 years ago

edsu commented 7 years ago

I think images may need to be resized, sometimes they fail like this:

2017-01-18 07:39:22,299 - root - ERROR - unable to tweet: [{'message': 'Image dimensions must be >= 4x4 and <= 8192x8192', 'code': 324}]
hugovk commented 6 years ago

Here's one way, maintain aspect ratio with 8192x8192 max resolution:

pip3 install pillow
from PIL import Image
im = Image.open(filename)
im.thumbnail((8192, 8192))
im.save(filename)

https://pillow.readthedocs.io/en/latest/reference/Image.html#examples