imagegenerated

Image Pad For Outpaint Masked(ImagePadForOutpaintMasked)

This node receives an image tensor and expands the image to a larger size based on the pixel values specified by the user for the top, bottom, left, and right directions.

Image Pad For Outpaint Masked

image
mask
IMAGE
MASK
left
INT
top
INT
right
INT
bottom
INT
feathering
INT
KJNodes

The Image Pad For Outpaint Masked node receives an image tensor and expands the image to a larger size based on the pixel values specified by the user for the top, bottom, left, and right directions.

Image Pad For Outpaint Masked is a specialized node for image outpainting. Its core function is to add a canvas of specified width around the original image and generate a corresponding mask for subsequent outpainting creation.

Node Functionality

This node receives an image tensor and expands the image to a larger size based on the pixel values specified by the user for the top, bottom, left, and right directions. The expanded area is filled with 50% gray by default. Its unique feature is the ability to receive an optional input mask, which will be inverted and correspondingly expanded to the new size, thereby precisely controlling which areas are "to be painted." If no mask is provided, the node generates a white mask covering all expanded areas.

Node Parameter Description - Image Pad For Outpaint Masked

Connection Inputs (Inputs)

Parameter NameData TypeRequiredDefault ValueRange/OptionsDescription
imageIMAGEYes--image (Input Parameter): The original input image to be expanded. The node will expand the canvas around this image as the center.
maskMASKNo--mask (Input Parameter): Optional parameter. A mask used to precisely specify the parts within the expanded area that need to be redrawn. White areas represent preservation, and black areas represent areas to be painted.

Control Parameters (Parameters)

Parameter NameData TypeRequiredDefault ValueRange/OptionsDescription
leftINTYes00 - MAX_RESOLUTION (Step: 8)left (Input Parameter): The width of the canvas to expand on the left side of the image, in pixels. The value range is 0 to MAX_RESOLUTION, with an adjustment step of 8.
topINTYes00 - MAX_RESOLUTION (Step: 8)top (Input Parameter): The height of the canvas to expand on the top of the image, in pixels. The value range is 0 to MAX_RESOLUTION, with an adjustment step of 8.
rightINTYes00 - MAX_RESOLUTION (Step: 8)right (Input Parameter): The width of the canvas to expand on the right side of the image, in pixels. The value range is 0 to MAX_RESOLUTION, with an adjustment step of 8.
bottomINTYes00 - MAX_RESOLUTION (Step: 8)bottom (Input Parameter): The height of the canvas to expand on the bottom of the image, in pixels. The value range is 0 to MAX_RESOLUTION, with an adjustment step of 8.
featheringINTYes00 - MAX_RESOLUTION (Step: 1)feathering (Input Parameter): The radius for feathering the edges of the generated mask, in pixels. The value range is 0 to MAX_RESOLUTION, with an adjustment step of 1.

Output

Parameter NameData TypeDescription
IMAGEIMAGEIMAGE (Output Parameter): The new image with the expanded canvas size, with the expanded area filled with neutral gray.
MASKMASKMASK (Output Parameter): The mask corresponding to the new image size, used to indicate the areas where AI should perform outpainting.

Usage Scenarios

In an image outpainting workflow, this node is typically placed at the beginning of the process. Users can first use it to set the desired canvas expansion area and initial mask, then pass the output image and mask to a text-to-image or image-to-image node to guide the AI in generating new image content within the areas marked by the mask, achieving seamless image expansion.

Notes

When the input mask is completely black, the node will treat it as if no mask was provided. Additionally, the feathering parameter can be used to feather the mask edges, but note that the feathering radius cannot exceed half of the original image dimensions; otherwise, the feathering effect may not take effect.

Image Pad For Outpaint Masked node is from the ComfyUI-KJNodes node package.

Comments

Sign in with GitHub to join the discussion.

Loading comments…