Merge image_handler from TUI fork
This commit is contained in:
parent
2fd144cfd3
commit
36d2c32975
5 changed files with 26 additions and 16 deletions
|
@ -47,13 +47,20 @@ class ImageProcessor:
|
|||
font = ImageFont.truetype("OpenDyslexic3-Regular.ttf", font_size)
|
||||
except:
|
||||
print("Error loading font for watermark, please ensure font is installed...\n")
|
||||
time.sleep(0.3)
|
||||
time.sleep(0.1)
|
||||
return image
|
||||
|
||||
c, w, textwidth, textheight, = drawer.textbbox(xy = (0, 0), text = text, font = font) # Getting text size, only need the last two values
|
||||
x = imagewidth - textwidth - margin
|
||||
y = imageheight - textheight - margin
|
||||
drawer.text((x, y), text, font = font)
|
||||
|
||||
# thin border
|
||||
drawer.text((x-1, y), text, font=font, fill=(64, 64, 64))
|
||||
drawer.text((x+1, y), text, font=font, fill=(64, 64, 64))
|
||||
drawer.text((x, y-1), text, font=font, fill=(64, 64, 64))
|
||||
drawer.text((x, y+1), text, font=font, fill=(64, 64, 64))
|
||||
# Adding text in the desired color
|
||||
drawer.text((x, y), text, font = font, fill=(255, 255, 255))
|
||||
|
||||
return image
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue