Add RM Make Image Batch node

Combines up to 5 images into a single batch, auto-resizing mismatched
dimensions to match the first image.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Moser9815
2026-03-12 17:07:01 -04:00
co-authored by Claude Opus 4.6
parent 794fcb9077
commit f3e100b9b4
2 changed files with 63 additions and 0 deletions
+4
View File
@@ -29,6 +29,8 @@ from .nodes.multi_detect_crop import NODE_CLASS_MAPPINGS as MULTI_DETECT_MAPPING
from .nodes.multi_detect_crop import NODE_DISPLAY_NAME_MAPPINGS as MULTI_DETECT_DISPLAY
from .nodes.math_expression import NODE_CLASS_MAPPINGS as MATH_EXPR_MAPPINGS
from .nodes.math_expression import NODE_DISPLAY_NAME_MAPPINGS as MATH_EXPR_DISPLAY
from .nodes.make_image_batch import NODE_CLASS_MAPPINGS as IMAGE_BATCH_MAPPINGS
from .nodes.make_image_batch import NODE_DISPLAY_NAME_MAPPINGS as IMAGE_BATCH_DISPLAY
# Combine all mappings
NODE_CLASS_MAPPINGS = {
@@ -45,6 +47,7 @@ NODE_CLASS_MAPPINGS = {
**FACE_DETAILER_MAPPINGS,
**MULTI_DETECT_MAPPINGS,
**MATH_EXPR_MAPPINGS,
**IMAGE_BATCH_MAPPINGS,
}
NODE_DISPLAY_NAME_MAPPINGS = {
@@ -61,6 +64,7 @@ NODE_DISPLAY_NAME_MAPPINGS = {
**FACE_DETAILER_DISPLAY,
**MULTI_DETECT_DISPLAY,
**MATH_EXPR_DISPLAY,
**IMAGE_BATCH_DISPLAY,
}
WEB_DIRECTORY = "./js"
+59
View File
@@ -0,0 +1,59 @@
"""
RM Make Image Batch - Combine multiple images into a single batch.
"""
import torch
class RMMakeImageBatch:
"""Combine up to 5 images into a single image batch."""
@classmethod
def INPUT_TYPES(cls):
return {
"required": {
"image1": ("IMAGE",),
},
"optional": {
"image2": ("IMAGE",),
"image3": ("IMAGE",),
"image4": ("IMAGE",),
"image5": ("IMAGE",),
},
}
RETURN_TYPES = ("IMAGE",)
FUNCTION = "process"
CATEGORY = "RMAutomation/Image"
def process(self, image1, image2=None, image3=None, image4=None, image5=None):
images = [image1]
for img in (image2, image3, image4, image5):
if img is not None:
images.append(img)
if len(images) == 1:
return (images[0],)
# Match dimensions to first image
target_h = images[0].shape[1]
target_w = images[0].shape[2]
result = []
for img in images:
if img.shape[1] != target_h or img.shape[2] != target_w:
img = torch.nn.functional.interpolate(
img.movedim(-1, 1), size=(target_h, target_w), mode="bilinear"
).movedim(1, -1)
result.append(img)
return (torch.cat(result, dim=0),)
NODE_CLASS_MAPPINGS = {
"RMMakeImageBatch": RMMakeImageBatch,
}
NODE_DISPLAY_NAME_MAPPINGS = {
"RMMakeImageBatch": "RM Make Image Batch",
}