added script for automatically creating wallpapers

This commit is contained in:
paul-loedige
2020-12-13 03:39:32 +01:00
parent b503ae2e27
commit 9585964496
2 changed files with 51 additions and 18 deletions
+29
View File
@@ -0,0 +1,29 @@
from PIL import Image, ImageDraw, ImageFont
import os
import time
hotkey_file='/home/paul/Hotkeys'
hotkey_picture='/home/paul/Hotkeys.png'
with open(hotkey_file) as file:
lines = [line.rstrip() for line in file]
text1=''
for line in lines[len(lines)//2:]:
text1+=line +"\n"
text2=''
for line in lines[:len(lines)//2]:
text2+=line +"\n"
if os.path.isfile(hotkey_picture):
os.remove(hotkey_picture)
image = Image.new(mode = "RGB", size = (1440,900), color=(43,46,59))
ImageDraw.Draw(image).text((10,10), text1, font=ImageFont.truetype('/usr/share/fonts/ubuntu/UbuntuMono-R.ttf',15), fill='#ffffff')
image.save(hotkey_picture)
image = Image.open(hotkey_picture)
ImageDraw.Draw(image).text((750,10), text2, font=ImageFont.truetype('/usr/share/fonts/ubuntu/UbuntuMono-R.ttf',15), fill='#ffffff')
image.save(hotkey_picture)
image.show()