KJNodes/imagegenerated

Pad Image Batch Interleaved(PadImageBatchInterleaved)

This node takes a four-dimensional tensor (batch, height, width, channels) as input and creates a new, longer tensor.

Pad Image Batch Interleaved

images
images
masks
empty_frames_per_image
1
pad_frame_value
0.00
add_after_last
KJNodes

The Pad Image Batch Interleaved node receives a four-dimensional tensor (batch, height, width, channels) as input and creates a new, longer tensor.

The Pad Image Batch Interleaved node is an image batch processing tool. Its core function is to insert a specified number of blank frames between consecutive image frames in a batch. It is primarily used to adjust the pacing of video or animation sequences by increasing the frame intervals, thereby extending the total duration of the sequence.

Node Function

This node receives a four-dimensional tensor (batch, height, width, channels) as input and creates a new, longer tensor. Its technical implementation involves placing the original image frames in order and padding with blank frames, composed of a specified grayscale value, between every two original frames (and optionally after the last frame). Simultaneously, it generates a corresponding mask to distinguish between the original frames (value 1) and the inserted blank frames (value 0).

Node Parameter Description - Pad Image Batch Interleaved

Connection Inputs (Inputs)

Parameter NameData TypeRequiredDefault ValueRange/OptionsDescription
imagesIMAGEYes--The input image batch to be processed.

Control Parameters (Parameters)

Parameter NameData TypeRequiredDefault ValueRange/OptionsDescription
empty_frames_per_imageINTYes10 - 4096 (Step: 1)empty_frames_per_image (Input Parameter): Sets the number of blank frames to insert between every two original images. The value is an integer ranging from 0 to 4096.
pad_frame_valueFLOATYes0.00.0 - 1.0 (Step: 0.01)pad_frame_value (Input Parameter): Defines the pixel grayscale value for the inserted blank frames. The value ranges from 0.0 (pure black) to 1.0 (pure white), with a step of 0.01.
add_after_lastBOOLEANYesFalse-add_after_last (Input Parameter): A boolean switch that determines whether to append the same number of blank frames after the last image in the input batch.

Output

Parameter NameData TypeDescription
imagesIMAGEimages (Output Parameter): Outputs the new image batch with blank frames inserted.
masksMASKmasks (Output Parameter): Outputs a mask used to identify which frames in the output batch are original and which are inserted blank frames.

Usage Scenarios

This node is very useful in animation workflows that require slow-motion or pause effects. For example, you can input a dynamically changing image sequence into this node, set the number of blank frames to insert, thereby creating brief "freeze-frame" effects between key actions, making the animation pacing better suit narrative needs.

Notes

The node's behavior differs when the input batch contains only a single image. If the add_after_last parameter is True, it will add blank frames after that image; if False, the output remains unchanged. Users need to choose based on the specific scenario.

The Pad Image Batch Interleaved node is from the ComfyUI-KJNodes node package.

Comments

Sign in with GitHub to join the discussion.

Loading comments…