Reference Concat's contact-sheet mode picked cell size from the median of the batch, so a single low-res reference capped every other tile's resolution once upstream batching forced a common size. Add Image List: auto-expanding IMAGE sockets (same pattern as Dynamic LoRA Stack) that output a native ComfyUI list instead of a stacked tensor, so mixed-resolution references never get resized before Reference Concat sees them. Reference Concat now declares INPUT_IS_LIST, accepts either an Image List or a legacy stacked batch, sizes its contact sheet from the largest reference (upscaling smaller ones to match instead of the reverse), and adds an interpolation widget (nearest/bilinear/bicubic/ lanczos) used for all internal resizing.
58 lines
1.6 KiB
Python
58 lines
1.6 KiB
Python
try:
|
|
from .utils import FlexibleOptionalInputType
|
|
except ImportError: # importable for tests without package context
|
|
from utils import FlexibleOptionalInputType
|
|
|
|
CATEGORY = "MoonPack/image"
|
|
|
|
|
|
def _input_index(key: str) -> int:
|
|
try:
|
|
return int(key.split("_")[-1])
|
|
except (IndexError, ValueError):
|
|
return -1
|
|
|
|
|
|
class ImageList:
|
|
DESCRIPTION = (
|
|
"Collects images from auto-expanding slots into a native ComfyUI list, without "
|
|
"stacking them into one batch tensor. Each image keeps its own native resolution, "
|
|
"so mixed-resolution references stay full quality until a downstream node (e.g. "
|
|
"Reference Concat) resizes them itself."
|
|
)
|
|
SEARCH_ALIASES = ["batch", "list", "images", "collect", "combine", "reference"]
|
|
|
|
@classmethod
|
|
def INPUT_TYPES(cls):
|
|
return {
|
|
"required": {},
|
|
"optional": FlexibleOptionalInputType("IMAGE"),
|
|
}
|
|
|
|
RETURN_TYPES = ("IMAGE",)
|
|
RETURN_NAMES = ("images",)
|
|
OUTPUT_IS_LIST = (True,)
|
|
FUNCTION = "collect"
|
|
CATEGORY = CATEGORY
|
|
|
|
def collect(self, **kwargs):
|
|
items = []
|
|
for key, value in kwargs.items():
|
|
if not key.startswith("image_") or value is None:
|
|
continue
|
|
idx = _input_index(key)
|
|
if idx < 0:
|
|
continue
|
|
items.append((idx, value))
|
|
items.sort(key=lambda kv: kv[0])
|
|
return ([value for _, value in items],)
|
|
|
|
|
|
NODE_CLASS_MAPPINGS = {
|
|
"MoonPack_ImageList": ImageList,
|
|
}
|
|
|
|
NODE_DISPLAY_NAME_MAPPINGS = {
|
|
"MoonPack_ImageList": "Image List",
|
|
}
|