diff --git a/py/image_reel.py b/py/image_reel.py index 708b1e5..1d5ec0d 100644 --- a/py/image_reel.py +++ b/py/image_reel.py @@ -91,9 +91,15 @@ class ImageReelComposit: def __init__(self): self.NODE_NAME = 'ImageReelComposit' + (_, self.FONT_DICT) = get_resource_dir() + self.FONT_LIST = list(self.FONT_DICT.keys()) @classmethod def INPUT_TYPES(self): + (LUT_DICT, FONT_DICT) = get_resource_dir() + FONT_LIST = list(FONT_DICT.keys()) + LUT_LIST = list(LUT_DICT.keys()) + color_theme_list = ['light', 'dark'] return { "required": { @@ -117,6 +123,7 @@ class ImageReelComposit: def image_reel_composit(self, reel_1, font_file, font_size, border, color_theme, reel_2=None, reel_3=None, reel_4=None,): + ret_images = [] if color_theme == 'light': @@ -182,7 +189,8 @@ class ImageReelComposit: return background_image def draw_reel_text(self, reel, font_file, font_size, text_color) -> Image: - font_path = FONT_DICT.get(font_file) + + font_path = self.FONT_DICT.get(font_file) font = ImageFont.truetype(font_path, font_size) texts = reel.texts text_image = Image.new('RGBA', (reel.image.width, reel.reel_border + int(font_size * 1.5)), color=(0, 0, 0, 0)) diff --git a/py/loadpsd.py b/py/loadpsd.py index 0cb9ff7..d780859 100644 --- a/py/loadpsd.py +++ b/py/loadpsd.py @@ -5,7 +5,7 @@ import folder_paths # import node_helpers from nodes import LoadImage from PIL import Image,ImageOps,ImageSequence,ImageDraw,ImageFont -from .imagefunc import pil2tensor, log, FONT_DICT, generate_text_image +from .imagefunc import pil2tensor, log, generate_text_image, get_resource_dir class LoadPSD(LoadImage): @@ -38,6 +38,8 @@ class LoadPSD(LoadImage): from psd_tools import PSDImage from psd_tools.api.layers import Layer + (LUT_DICT, FONT_DICT) = get_resource_dir() + NODE_NAME = 'LoadPSD' number_of_layers = 1 layer_image = [] diff --git a/py/simple_text_image.py b/py/simple_text_image.py index 7b71ee1..eeb06f0 100644 --- a/py/simple_text_image.py +++ b/py/simple_text_image.py @@ -13,6 +13,9 @@ class SimpleTextImage: @classmethod def INPUT_TYPES(self): + (_, FONT_DICT) = get_resource_dir() + FONT_LIST = list(FONT_DICT.keys()) + return { "required": { "text": ("STRING",{"default": "text", "multiline": True}, @@ -46,6 +49,9 @@ class SimpleTextImage: width, height, size_as=None ): + (_, FONT_DICT) = get_resource_dir() + FONT_LIST = list(FONT_DICT.keys()) + ret_images = [] ret_masks = [] if size_as is not None: diff --git a/py/text_image.py b/py/text_image.py index ccd10e7..4c0830f 100644 --- a/py/text_image.py +++ b/py/text_image.py @@ -10,8 +10,13 @@ class TextImage: @classmethod def INPUT_TYPES(self): + + (_, FONT_DICT) = get_resource_dir() + FONT_LIST = list(FONT_DICT.keys()) + layout_list = ['horizontal', 'vertical'] random_seed = int(time.time()) + return { "required": { "text": ("STRING", {"multiline": True, "default": "Text"}), @@ -44,6 +49,9 @@ class TextImage: size_as=None ): + + (_, FONT_DICT) = get_resource_dir() + FONT_LIST = list(FONT_DICT.keys()) # spacing -= 20 # leading += 20 # scale *= 0.7 diff --git a/py/text_image_v2.py b/py/text_image_v2.py index 9c933cf..14fe733 100644 --- a/py/text_image_v2.py +++ b/py/text_image_v2.py @@ -10,6 +10,10 @@ class TextImage_v2: @classmethod def INPUT_TYPES(self): + + (_, FONT_DICT) = get_resource_dir() + FONT_LIST = list(FONT_DICT.keys()) + layout_list = ['horizontal', 'vertical'] random_seed = int(time.time()) return { @@ -44,6 +48,10 @@ class TextImage_v2: size_as=None ): + + (_, FONT_DICT) = get_resource_dir() + FONT_LIST = list(FONT_DICT.keys()) + if size_as is not None: width, height = tensor2pil(size_as).size text_table = [] diff --git a/pyproject.toml b/pyproject.toml index cd007f0..475345f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [project] name = "comfyui_layerstyle" description = "A set of nodes for ComfyUI it generate image like Adobe Photoshop's Layer Style. the Drop Shadow is first completed node, and follow-up work is in progress." -version = "1.0.62" +version = "1.0.63" license = "MIT" dependencies = ["numpy", "pillow", "torch", "matplotlib", "Scipy", "scikit_image", "scikit_learn", "opencv-contrib-python", "pymatting", "segment_anything", "timm", "addict", "yapf", "colour-science", "wget", "mediapipe", "loguru", "typer_config", "fastapi", "rich", "google-generativeai", "diffusers", "omegaconf", "tqdm", "transformers", "kornia", "image-reward", "ultralytics", "blend_modes", "blind-watermark", "qrcode", "pyzbar", "transparent-background", "huggingface_hub", "accelerate", "bitsandbytes", "torchscale", "wandb", "hydra-core", "psd-tools", "inference-cli[yolo-world]", "inference-gpu[yolo-world]", "onnxruntime"]