diff --git a/__init__.py b/__init__.py index a86ac44..c791e69 100644 --- a/__init__.py +++ b/__init__.py @@ -1250,8 +1250,33 @@ class ToPixel: pixelated_image.putpixel((j // tile_size, i // tile_size), tuple(dominant_color.astype(int))) pixelated_image = imgToTensor(pixelated_image) + garbage_collect() return (pixelated_image,) +class StringListToOneLine: + def __init__(self) -> None: + pass + + @classmethod + def INPUT_TYPES(s): + return { + "required": { + "StringList": ("STRING", {"forceInput": True}), + "split":("STRING", {"default": ","}) + }, + } + + CATEGORY = "badger" + RETURN_TYPES = ("STRING",) + FUNCTION = "string_line" + OUTPUT_NODE = True + + def string_line(self,StringList,split): + print(len(StringList)) + if len(StringList) <= 1: + return (StringList,) + else : + return (split.join(StringList),) NODE_CLASS_MAPPINGS = { "ImageOverlap-badger": ImageOverlap, @@ -1282,7 +1307,8 @@ NODE_CLASS_MAPPINGS = { "IdentifyColorToMask-badger":IdentifyColorToMask, "IdentifyBorderColorToMask-badger":IdentifyBorderColorToMask, "GarbageCollect-badger": GarbageCollect, - "ToPixel-badger": ToPixel + "ToPixel-badger": ToPixel, + "StringListToOneLine-badger": StringListToOneLine } diff --git a/pixel.py b/pixel.py index 7de31f8..9ac6d15 100644 --- a/pixel.py +++ b/pixel.py @@ -42,7 +42,10 @@ def regular_image(original_image, output_size=(512, 512), fill_color=(255, 255, new_height = int(original_height * ratio) # 等比缩放图片 - original_image = original_image.resize((new_width, new_height), Image.ANTIALIAS) + try: + original_image = original_image.resize((new_width, new_height), Image.Resampling.LANCZOS) + except Exception as e: + original_image = original_image.resize((new_width, new_height), Image.ANTIALIAS) # 创建一个新的白色背景图片 new_img = Image.new("RGB", output_size, fill_color)