Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import json
- from PIL import Image, ImageDraw
- with open("dates.json") as fp:
- dates = json.load(fp)
- dates.sort()
- print(dates[:10])
- new_dates = []
- for date in dates:
- new_dates.append(int(date/86400)-int(dates[0]/86400))
- print(new_dates[-1])
- im = Image.new("RGB", (new_dates[-1]+1, len(new_dates)))
- draw = ImageDraw.Draw(im)
- currentpixel = 0
- totalMember = 0
- for date in new_dates:
- totalMember += 1
- for i in range(currentpixel, date-currentpixel):
- draw.line((im.height, im.height-totalMember, i, im.height-totalMember), fill=(0, 180, 0))
- currentpixel = date
- draw.line((im.height, im.height-totalMember, currentpixel, im.height-totalMember), fill=(0, 180, 0))
- im.save("output.png", "png")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement