KJNodes/textgenerated

Image Batch Test Pattern(ImageBatchTestPattern)

From a technical implementation perspective, this node uses Python's PIL library (Pillow) to draw images based on the specified batch size and starting number.

Image Batch Test Pattern

image
batch_size
1
start_from
0
text_x
256
text_y
256
width
512
height
512
font
COMBO
font_size
255
KJNodes

From a technical implementation perspective, the Image Batch Test Pattern node uses Python's PIL library (Pillow) to draw images based on the specified batch size and starting number.

The Image Batch Test Pattern node is used to batch generate test images with sequential numbers. It creates a series of images on a black background, each containing a number with a randomly generated color. This node is primarily used to create image sequences for testing or demonstration purposes.

Node Functionality

From a technical implementation perspective, this node uses Python's PIL library (Pillow) to draw images based on the specified batch size and starting number. It allows users to customize the overall image dimensions, text position, font, and font size. The text drawing coordinates use the top-left corner of the image as the origin, and support selecting TrueType font files from the kjnodes_fonts folder.

Node Parameter Description - Image Batch Test Pattern

Connection Inputs (Inputs)

Parameter NameData TypeRequiredDefault ValueRange/OptionsDescription
fontCOMBOYes--font (input parameter): Select the font file from the kjnodes_fonts directory for drawing the numbers.

Control Parameters (Parameters)

Parameter NameData TypeRequiredDefault ValueRange/OptionsDescription
batch_sizeINTYes11 - 4096 (step: 1)batch_size (input parameter): Specifies the number of images to generate, ranging from 1 to 4096.
start_fromINTYes00 - 4096 (step: 1)start_from (input parameter): Sets the starting number for the sequence on the images, ranging from 0 to 4096.
text_xINTYes2560 - 4096 (step: 1)text_x (input parameter): Sets the X-coordinate of the top-left corner of the number text within the image, ranging from 0 to 4096.
text_yINTYes2560 - 4096 (step: 1)text_y (input parameter): Sets the Y-coordinate of the top-left corner of the number text within the image, ranging from 0 to 4096.
widthINTYes51216 - 4096 (step: 1)width (input parameter): Sets the width of the generated images, ranging from 16 to 4096.
heightINTYes51216 - 4096 (step: 1)height (input parameter): Sets the height of the generated images, ranging from 16 to 4096.
font_sizeINTYes2558 - 4096 (step: 1)font_size (input parameter): Sets the font size of the number text, ranging from 8 to 4096.

Output

Parameter NameData TypeDescription
IMAGEIMAGEThe batch of test images with sequential numbers.

Usage Scenarios

In practical workflows, this node is often used in scenarios requiring batch image input for processing. For example, when testing the batch processing capability of an image upscaling model, this node can first generate a set of test images with uniform dimensions but varying content (numbers). These can then be connected to an upscaling node to observe the model's processing effectiveness and consistency with batch input.

Notes

Please note that the number of generated images is limited by the batch_size parameter (up to 4096) and the starting number start_from (up to 4096); they can be set independently. Additionally, if the text drawing position (text_x, text_y) is set inappropriately, the text may be drawn outside the canvas and become invisible.

The Image Batch Test Pattern node is from the ComfyUI-KJNodes node package.

Comments

Sign in with GitHub to join the discussion.

Loading comments…