Skip to content

Commit

Permalink
fix bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
chflame163 committed Sep 23, 2024
1 parent be52ed8 commit 9585eca
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 3 deletions.
10 changes: 9 additions & 1 deletion py/image_reel.py
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand All @@ -117,6 +123,7 @@ def INPUT_TYPES(self):

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':
Expand Down Expand Up @@ -182,7 +189,8 @@ def paste_drop_shadow(self, background_image, image, text_image, box, shadow_siz
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))
Expand Down
4 changes: 3 additions & 1 deletion py/loadpsd.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# 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):
Expand Down Expand Up @@ -38,6 +38,8 @@ def load_psd(self, image, file_path, include_hidden_layer, layer_index, find_lay
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 = []
Expand Down
6 changes: 6 additions & 0 deletions py/simple_text_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ def __init__(self):
@classmethod
def INPUT_TYPES(self):

(_, FONT_DICT) = get_resource_dir()
FONT_LIST = list(FONT_DICT.keys())

return {
"required": {
"text": ("STRING",{"default": "text", "multiline": True},
Expand Down Expand Up @@ -46,6 +49,9 @@ def simple_text_image(self, text, font_file, align, char_per_line,
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:
Expand Down
8 changes: 8 additions & 0 deletions py/text_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,13 @@ def __init__(self):

@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"}),
Expand Down Expand Up @@ -44,6 +49,9 @@ def text_image(self, text, font_file, spacing, leading, horizontal_border, verti
size_as=None
):


(_, FONT_DICT) = get_resource_dir()
FONT_LIST = list(FONT_DICT.keys())
# spacing -= 20
# leading += 20
# scale *= 0.7
Expand Down
8 changes: 8 additions & 0 deletions py/text_image_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ def __init__(self):

@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 {
Expand Down Expand Up @@ -44,6 +48,10 @@ def text_image(self, text, font_file, spacing, leading, horizontal_border, verti
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 = []
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -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"]

Expand Down

0 comments on commit 9585eca

Please sign in to comment.