mirror of
https://git.datalinker.icu/kijai/ComfyUI-KJNodes.git
synced 2026-01-28 08:07:15 +08:00
Merge branch 'main' of https://github.com/kijai/ComfyUI-KJNodes
This commit is contained in:
commit
f043d2b22f
16
nodes.py
16
nodes.py
@ -618,7 +618,10 @@ class CreateTextMask:
|
||||
text_height = font_size
|
||||
text_center_x = text_x + text_width / 2
|
||||
text_center_y = text_y + text_height / 2
|
||||
draw.text((text_x, text_y), text, font=font, fill=font_color, features=['-liga'])
|
||||
try:
|
||||
draw.text((text_x, text_y), text, font=font, fill=font_color, features=['-liga'])
|
||||
except:
|
||||
draw.text((text_x, text_y), text, font=font, fill=font_color)
|
||||
if start_rotation != end_rotation:
|
||||
image = image.rotate(rotation, center=(text_center_x, text_center_y))
|
||||
rotation += rotation_increment
|
||||
@ -1384,7 +1387,10 @@ class ImageBatchTestPattern:
|
||||
text_x = (width - text_width / 2) // 2
|
||||
text_y = (height - text_height) // 2
|
||||
|
||||
draw.text((text_x, text_y), str(number + start_from), font=font, fill=color, features=['-liga'])
|
||||
try:
|
||||
draw.text((text_x, text_y), text, font=font, fill=font_color, features=['-liga'])
|
||||
except:
|
||||
draw.text((text_x, text_y), text, font=font, fill=font_color)
|
||||
|
||||
# Convert the image to a numpy array and normalize the pixel values
|
||||
image = np.array(image).astype(np.float32) / 255.0
|
||||
@ -2757,7 +2763,11 @@ class AddLabel:
|
||||
label_image = Image.new("RGB", (width, height), label_color)
|
||||
draw = ImageDraw.Draw(label_image)
|
||||
font = ImageFont.truetype(font_path, font_size)
|
||||
draw.text((text_x, text_y), text, font=font, fill=font_color, features=['-liga'])
|
||||
try:
|
||||
draw.text((text_x, text_y), text, font=font, fill=font_color, features=['-liga'])
|
||||
except:
|
||||
draw.text((text_x, text_y), text, font=font, fill=font_color)
|
||||
|
||||
label_image = np.array(label_image).astype(np.float32) / 255.0
|
||||
label_image = torch.from_numpy(label_image)[None, :, :, :]
|
||||
# Duplicate the label image for the entire batch
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user