Visit ComfyUI Online for ready-to-use ComfyUI environment
Generate masks from latent representations using bounding box coordinates for precise image manipulation.
The LatentToMaskBB
node is designed to generate a mask from a latent representation by defining a bounding box within the latent space. This node is particularly useful for AI artists who need to create precise masks for specific regions in their latent images, enabling more controlled and targeted image manipulation. By specifying the coordinates and dimensions of the bounding box, you can isolate and mask specific areas of the latent image, which can then be used for various image processing tasks such as inpainting, compositing, or applying effects. This node simplifies the process of creating masks directly from latent representations, making it an essential tool for detailed and accurate image editing.
This parameter represents the latent representation from which the mask will be generated. It is a dictionary containing the latent samples, which are the encoded features of the image. The latent representation is crucial as it serves as the source data for creating the mask.
This parameter specifies the x-coordinate of the top-left corner of the bounding box within the latent space. It is a float value ranging from 0.0 to 1.0, where 0.0 represents the leftmost edge and 1.0 represents the rightmost edge of the latent image. The default value is 0.0.
This parameter specifies the y-coordinate of the top-left corner of the bounding box within the latent space. It is a float value ranging from 0.0 to 1.0, where 0.0 represents the topmost edge and 1.0 represents the bottommost edge of the latent image. The default value is 0.0.
This parameter defines the width of the bounding box as a float value ranging from 0.0 to 1.0. The width is relative to the total width of the latent image, with 1.0 representing the full width. The default value is 1.0.
This parameter defines the height of the bounding box as a float value ranging from 0.0 to 1.0. The height is relative to the total height of the latent image, with 1.0 representing the full height. The default value is 1.0.
This parameter sets the value to be assigned to the pixels within the bounding box. It is a float value, typically set to 1.0 to indicate the masked region. The default value is 1.0.
This parameter sets the value to be assigned to the pixels outside the bounding box. It is a float value, typically set to 0.0 to indicate the unmasked region. The default value is 0.0.
The output is a mask tensor that corresponds to the specified bounding box within the latent representation. The mask is a binary tensor where the pixels inside the bounding box are set to the specified value
(usually 1.0), and the pixels outside the bounding box are set to the outer_value
(usually 0.0). This mask can be used for various image processing tasks, providing a precise and controlled way to manipulate specific regions of the latent image.
x
, y
, w
, and h
parameters are within the range of 0.0 to 1.0 to avoid errors and ensure the bounding box is correctly defined within the latent space.value
and outer_value
parameters to clearly distinguish between the masked and unmasked regions, typically setting value
to 1.0 and outer_value
to 0.0.LatentCompositeMasked
or SetLatentNoiseMask
to perform advanced image manipulations using the generated mask.x
and w
is less than or equal to 1.0, and the sum of y
and h
is less than or equal to 1.0. Adjust the values accordingly to fit within the latent image boundaries.latent
parameter is not in the expected format, which should be a dictionary containing the key "samples".© Copyright 2024 RunComfy. All Rights Reserved.