Last active
June 15, 2019 01:59
-
-
Save snuke/5fe531ef1d33494fb9973d0840ebf609 to your computer and use it in GitHub Desktop.
rotate twitter icon
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import twitter # pip install python-twitter | |
from PIL import Image # pip install pillow | |
import datetime, calendar | |
icon_path = 'icon.jpg' | |
save_path = 'tmp.jpg' | |
api = twitter.Api( | |
consumer_key='', | |
consumer_secret='', | |
access_token_key='', | |
access_token_secret='' | |
) | |
# today = datetime.date.today() | |
# day = today.day | |
# days = calendar.monthrange(today.year, today.month)[1] | |
# angle = 360*(day-1)/days | |
angle = 360*(datetime.datetime.now().hour)/12 | |
img = Image.open(icon_path) | |
img.rotate(-angle, fillcolor=(255,255,255)).save(save_path) | |
api.UpdateImage(save_path) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment