Visit ComfyUI Online for ready-to-use ComfyUI environment
Blend overlay onto background image with mask for precise composition in AI art.
The Bjornulf_CombineBackgroundOverlay
node is designed to seamlessly blend an overlay image onto a background image using a specified mask to define transparency levels. This node is particularly useful for AI artists who want to create composite images by layering different visual elements with precision. By converting images from torch tensors to numpy arrays and then to PIL images, it allows for detailed manipulation of image data. The node calculates the exact position for the overlay based on user-defined horizontal and vertical percentages, ensuring that the overlay is placed exactly where desired on the background. This process results in a new image that combines the background and overlay with the mask applied, providing a powerful tool for creating complex visual compositions.
The background
parameter is an image that serves as the base layer onto which the overlay will be applied. It is expected to be in the form of a torch tensor, which is then converted to a numpy array for processing. This parameter is crucial as it defines the canvas size and the primary visual context for the overlay.
The overlay
parameter is the image that will be placed on top of the background. Like the background, it is initially a torch tensor and is converted to a numpy array. The overlay image is combined with the mask to create transparency effects, allowing for intricate layering and blending with the background.
The mask
parameter is used to define the transparency levels of the overlay image. It is also a torch tensor converted to a numpy array, and it determines which parts of the overlay are visible and which are transparent. This parameter is essential for achieving smooth transitions and realistic blending between the overlay and the background.
The horizontal_position
parameter is a float that specifies the horizontal placement of the overlay on the background as a percentage. The default value is 50, with a range from -50 to 150, allowing for flexible positioning beyond the edges of the background. This parameter helps in aligning the overlay precisely on the horizontal axis.
The vertical_position
parameter is a float that determines the vertical placement of the overlay on the background as a percentage. It also defaults to 50 and ranges from -50 to 150, providing the ability to position the overlay above or below the visible area of the background. This parameter is key for vertical alignment of the overlay.
The output parameter is an IMAGE
, which is the final composite image resulting from the combination of the background and overlay with the mask applied. This image is returned as a torch tensor, ready for further processing or saving. The output image retains the dimensions of the background and incorporates the overlay with the specified transparency and positioning, making it a versatile result for various artistic applications.
horizontal_position
and vertical_position
parameters carefully, considering the dimensions of both the background and overlay images.mask
to control the transparency of the overlay effectively, ensuring that the blending between the overlay and background appears natural and seamless.RunComfy is the premier ComfyUI platform, offering ComfyUI online environment and services, along with ComfyUI workflows featuring stunning visuals. RunComfy also provides AI Playground, enabling artists to harness the latest AI tools to create incredible art.