mirror of
https://git.datalinker.icu/kijai/ComfyUI-KJNodes.git
synced 2025-12-14 23:34:35 +08:00
Fix text drawing for new pillow
This commit is contained in:
parent
e27ee15c8b
commit
2a7b1ce405
3
nodes.py
3
nodes.py
@ -453,7 +453,8 @@ class CreateTextMask:
|
|||||||
image = Image.new("RGB", (width, height), "black")
|
image = Image.new("RGB", (width, height), "black")
|
||||||
draw = ImageDraw.Draw(image)
|
draw = ImageDraw.Draw(image)
|
||||||
font = ImageFont.truetype(font_path, font_size)
|
font = ImageFont.truetype(font_path, font_size)
|
||||||
text_width, text_height = draw.textsize(text, font=font)
|
text_width = font.getlength(text)
|
||||||
|
text_height = font_size
|
||||||
text_center_x = text_x + text_width / 2
|
text_center_x = text_x + text_width / 2
|
||||||
text_center_y = text_y + text_height / 2
|
text_center_y = text_y + text_height / 2
|
||||||
draw.text((text_x, text_y), text, font=font, fill=font_color)
|
draw.text((text_x, text_y), text, font=font, fill=font_color)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user