ComfyUI > Nodes > comfy_Pond_Nodes > 🐳图像扩展

ComfyUI Node: 🐳图像扩展

Class Name

ImageAlignByMask

Category
🐳Pond/image
Author
Pondowner857 (Account age: 730days)
Extension
comfy_Pond_Nodes
Latest Updated
2026-01-28
Github Stars
0.04K

How to Install comfy_Pond_Nodes

Install this extension via the ComfyUI Manager by searching for comfy_Pond_Nodes
  • 1. Click the Manager button in the main menu
  • 2. Select Custom Nodes Manager button
  • 3. Enter comfy_Pond_Nodes in the search bar
After installation, click the Restart button to restart ComfyUI. Then, manually refresh your browser to clear the cache and access the updated list of nodes.

Visit ComfyUI Online for ready-to-use ComfyUI environment

  • Free trial available
  • 16GB VRAM to 80GB VRAM GPU machines
  • 400+ preloaded models/nodes
  • Freedom to upload custom models/nodes
  • 200+ ready-to-run workflows
  • 100% private workspace with up to 200GB storage
  • Dedicated Support

Run ComfyUI Online

🐳图像扩展 Description

Aligns images using a mask for precise positioning with various alignment and customization options.

🐳图像扩展:

The ImageAlignByMask node is designed to facilitate the alignment of images based on a specified mask, allowing for precise positioning and integration of visual elements. This node is particularly useful in scenarios where you need to align one image with another using a mask as a reference, ensuring that the content of the images is positioned accurately according to the desired alignment strategy. The node supports various alignment options such as centering, left, right, top, bottom, and corner alignments, providing flexibility in how images are arranged. By leveraging this node, you can achieve seamless integration of images, which is essential for creating cohesive and visually appealing compositions. The node also allows for user-defined offsets and fill colors, offering additional customization to suit specific artistic needs.

🐳图像扩展 Input Parameters:

base_bounds

The base_bounds parameter defines the bounding box of the base image, which serves as the reference for alignment. It is a tuple consisting of four integers representing the x and y coordinates of the top-left corner, followed by the width and height of the bounding box. This parameter is crucial as it determines the area within which the alignment will be calculated.

mask2_bounds

The mask2_bounds parameter specifies the bounding box of the second mask, which is used to align the image. Similar to base_bounds, it is a tuple of four integers indicating the x and y coordinates of the top-left corner, along with the width and height. This parameter helps in determining how the second image should be positioned relative to the base image.

base_size

The base_size parameter provides the dimensions of the base image as a tuple of two integers: width and height. This information is essential for calculating the alignment and ensuring that the images fit within the specified dimensions.

mask2_size

The mask2_size parameter indicates the dimensions of the second mask, also as a tuple of two integers: width and height. This parameter is used to ensure that the second image is aligned correctly within the bounds of the base image.

alignment

The alignment parameter determines the alignment strategy to be used. It can take values such as "居中对齐" (center alignment), "左对齐" (left alignment), "右对齐" (right alignment), "上对齐" (top alignment), "下对齐" (bottom alignment), and various corner alignments. This parameter is key to defining how the images will be positioned relative to each other.

offset_x

The offset_x parameter allows you to specify a horizontal offset in pixels, which is applied to the aligned position. This provides additional control over the final placement of the image, enabling fine-tuning of the alignment.

offset_y

The offset_y parameter functions similarly to offset_x, but for the vertical axis. It allows you to adjust the vertical position of the aligned image, offering further customization of the alignment.

fill_color

The fill_color parameter specifies the color to be used for filling any empty areas that result from the alignment process. This ensures that the final image composition does not have any unintended transparent or blank spaces.

🐳图像扩展 Output Parameters:

aligned_image

The aligned_image parameter is the primary output of the node, representing the image that has been aligned according to the specified mask and alignment strategy. This output is crucial for verifying that the alignment has been executed as intended and for further processing or integration into larger compositions.

merged_mask

The merged_mask parameter provides the combined mask resulting from the alignment process. It is useful for understanding how the masks have been integrated and for any subsequent operations that may require a unified mask.

🐳图像扩展 Usage Tips:

  • Experiment with different alignment options to see which best suits your composition needs. The node supports a variety of alignments, so try them out to achieve the desired visual effect.
  • Use the offset_x and offset_y parameters to fine-tune the position of the aligned image. Small adjustments can make a significant difference in achieving a perfect alignment.
  • Consider the fill_color parameter carefully, especially if your composition involves transparent or semi-transparent elements. Choosing the right fill color can enhance the overall appearance of the final image.

🐳图像扩展 Common Errors and Solutions:

Misaligned Images

  • Explanation: The images may not align as expected due to incorrect bounding box or size parameters.
  • Solution: Double-check the base_bounds, mask2_bounds, base_size, and mask2_size parameters to ensure they accurately reflect the dimensions and positions of the images and masks.

Unexpected Transparent Areas

  • Explanation: Transparent areas may appear if the fill_color is not set correctly or if the alignment results in gaps.
  • Solution: Set an appropriate fill_color to fill any gaps and ensure that the alignment parameters are correctly configured to minimize empty spaces.

Incorrect Alignment

  • Explanation: The alignment strategy may not be suitable for the desired outcome.
  • Solution: Review the alignment parameter and try different options to find the one that best fits your needs. Adjust offset_x and offset_y if necessary to achieve the correct positioning.

🐳图像扩展 Related Nodes

Go back to the extension to check out more related nodes.
comfy_Pond_Nodes
RunComfy
Copyright 2025 RunComfy. All Rights Reserved.

RunComfy is the premier ComfyUI platform, offering ComfyUI online environment and services, along with ComfyUI workflows featuring stunning visuals. RunComfy also provides AI Models, enabling artists to harness the latest AI tools to create incredible art.

🐳图像扩展