Added Main Programm
Added the Main Programm i coded before!
This commit is contained in:
13
render/utils/text_align.py
Normal file
13
render/utils/text_align.py
Normal file
@@ -0,0 +1,13 @@
|
||||
from PIL import Image
|
||||
from PIL import ImageFont
|
||||
from PIL import ImageDraw
|
||||
|
||||
|
||||
def get_text_align(text, font, pic_size):
|
||||
ascent, descent = font.getmetrics()
|
||||
w = font.getmask(text).getbbox()[2]
|
||||
h = font.getmask(text).getbbox()[3] + descent
|
||||
|
||||
h += int(h * 0.21)
|
||||
|
||||
return (pic_size[0] - w) / 2, (pic_size[1] - h) / 2
|
||||
Reference in New Issue
Block a user